This patch moves spin_lock (&dev->lock) before first use of dev.
I think that test to the state of device should be protected with
this spin_lock...

Feedback and comments are highly appreciated.

Signed-off-by: Milan Svoboda <[EMAIL PROTECTED]>
---

diff -uprN -X orig.bak.never.touch/Documentation/dontdiff 
orig.bak.never.touch/drivers/usb/gadget/inode.c 
new_gadget/drivers/usb/gadget/inode.c
--- orig.bak.never.touch/drivers/usb/gadget/inode.c     2006-06-19 
14:48:25.000000000 +0000
+++ new_gadget/drivers/usb/gadget/inode.c       2006-06-23 15:03:31.000000000 
+0000
@@ -1695,16 +1783,17 @@ gadgetfs_disconnect (struct usb_gadget *
 {
        struct dev_data         *dev = get_gadget_data (gadget);
 
+       spin_lock (&dev->lock);
        if (dev->state == STATE_UNCONNECTED) {
                DBG (dev, "already unconnected\n");
-               return;
+               goto exit;
        }
        dev->state = STATE_UNCONNECTED;
 
        INFO (dev, "disconnected\n");
-       spin_lock (&dev->lock);
        next_event (dev, GADGETFS_DISCONNECT);
        ep0_readable (dev);
+exit:
        spin_unlock (&dev->lock);
 }
 
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