From: Alan Stern Date: Fri, 6 May 2005 19:41:08 +0000 (-0400) Subject: [PATCH] usbcore: Don't call device_release_driver recursively X-Git-Tag: v2.6.13-rc4~130^2~203^2^2~25 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=f409661877a25d11c2495bcd879807f17c286684;p=safe%2Fjmp%2Flinux-2.6 [PATCH] usbcore: Don't call device_release_driver recursively 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 6667876..a3c4220 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -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);