aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-01-17 02:06:07 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:44:39 -0500
commitce46794f77f698eaf3b80922fafac5a9379085e0 (patch)
treea2adffcbc277f721d92eaa1fef3bdf6e14f66d57 /drivers/usb
parent5b89db02a5a7c8bad3c6fb7888778082a441b385 (diff)
USB: gadgetfs behaves better on userspace init bug
Resolve an initizlization issue that could come up if the userspace driver wrote invalid descriptors to a dual-speed device. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index e5ce4f0bb7cc..1c5e1ee7e36b 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1392,17 +1392,17 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1392 spin_lock (&dev->lock); 1392 spin_lock (&dev->lock);
1393 dev->setup_abort = 0; 1393 dev->setup_abort = 0;
1394 if (dev->state == STATE_DEV_UNCONNECTED) { 1394 if (dev->state == STATE_DEV_UNCONNECTED) {
1395
1396 dev->state = STATE_DEV_CONNECTED;
1397 dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
1398
1399#ifdef CONFIG_USB_GADGET_DUALSPEED 1395#ifdef CONFIG_USB_GADGET_DUALSPEED
1400 if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { 1396 if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
1397 spin_unlock(&dev->lock);
1401 ERROR (dev, "no high speed config??\n"); 1398 ERROR (dev, "no high speed config??\n");
1402 return -EINVAL; 1399 return -EINVAL;
1403 } 1400 }
1404#endif /* CONFIG_USB_GADGET_DUALSPEED */ 1401#endif /* CONFIG_USB_GADGET_DUALSPEED */
1405 1402
1403 dev->state = STATE_DEV_CONNECTED;
1404 dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
1405
1406 INFO (dev, "connected\n"); 1406 INFO (dev, "connected\n");
1407 event = next_event (dev, GADGETFS_CONNECT); 1407 event = next_event (dev, GADGETFS_CONNECT);
1408 event->u.speed = gadget->speed; 1408 event->u.speed = gadget->speed;