From: David Brownell <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/gadget/inode.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index e5ce4f0..1c5e1ee 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)
        spin_lock (&dev->lock);
        dev->setup_abort = 0;
        if (dev->state == STATE_DEV_UNCONNECTED) {
-
-               dev->state = STATE_DEV_CONNECTED;
-               dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
-
 #ifdef CONFIG_USB_GADGET_DUALSPEED
                if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
+                       spin_unlock(&dev->lock);
                        ERROR (dev, "no high speed config??\n");
                        return -EINVAL;
                }
 #endif /* CONFIG_USB_GADGET_DUALSPEED */
 
+               dev->state = STATE_DEV_CONNECTED;
+               dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket;
+
                INFO (dev, "connected\n");
                event = next_event (dev, GADGETFS_CONNECT);
                event->u.speed = gadget->speed;
-- 
1.4.4.4


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to