]> err.no Git - linux-2.6/commitdiff
[PATCH] usbcore: Don't call device_release_driver recursively
authorAlan Stern <stern@rowland.harvard.edu>
Fri, 6 May 2005 19:41:08 +0000 (15:41 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jun 2005 22:15:29 +0000 (15:15 -0700)
This patch fixes usb_driver_release_interface() to make it avoid calling
device_release_driver() recursively, i.e., when invoked from within the
disconnect routine for the same device.  The patch applies to your
"driver" tree.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/usb.c

index 66678763c24dc87c8f966239af0d8268b361deee..a3c42203213a7d70d3b9b0d282136cd785d75939 100644 (file)
@@ -322,9 +322,15 @@ void usb_driver_release_interface(struct usb_driver *driver,
        if (!dev->driver || dev->driver != &driver->driver)
                return;
 
-       /* don't disconnect from disconnect(), or before dev_add() */
-       if (!klist_node_attached(&dev->knode_driver) && !klist_node_attached(&dev->knode_bus))
+       /* don't release from within disconnect() */
+       if (iface->condition != USB_INTERFACE_BOUND)
+               return;
+
+       /* release only after device_add() */
+       if (klist_node_attached(&dev->knode_bus)) {
+               iface->condition = USB_INTERFACE_UNBINDING;
                device_release_driver(dev);
+       }
 
        dev->driver = NULL;
        usb_set_intfdata(iface, NULL);