Hi,

as the skeleton driver was made ready for autosuspend a race condition
was introduced. The reference to get device must be gotten before the
autosuspend counter is upped, as this operation may sleep, dropping BKL.
Dropping BKL means that the pointer to the device may become invalid.
Here's the fix.

        Regards
                Oliver

Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
----

--- a/drivers/usb/usb-skeleton.c        2007-02-08 15:32:17.000000000 +0100
+++ b/drivers/usb/usb-skeleton.c        2007-02-08 15:33:19.000000000 +0100
@@ -90,13 +90,15 @@
                goto exit;
        }
 
+       /* increment our usage count for the device */
+       kref_get(&dev->kref);
+
        /* prevent the device from being autosuspended */
        retval = usb_autopm_get_interface(interface);
-       if (retval)
+       if (retval) {
+               kref_put(&dev->kref, skel_delete);
                goto exit;
-
-       /* increment our usage count for the device */
-       kref_get(&dev->kref);
+       }
 
        /* save our object in the file's private structure */
        file->private_data = dev;

-------------------------------------------------------------------------
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