Commit f4096618 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c95a6b05
...@@ -322,9 +322,15 @@ void usb_driver_release_interface(struct usb_driver *driver, ...@@ -322,9 +322,15 @@ void usb_driver_release_interface(struct usb_driver *driver,
if (!dev->driver || dev->driver != &driver->driver) if (!dev->driver || dev->driver != &driver->driver)
return; return;
/* don't disconnect from disconnect(), or before dev_add() */ /* don't release from within disconnect() */
if (!klist_node_attached(&dev->knode_driver) && !klist_node_attached(&dev->knode_bus)) 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); device_release_driver(dev);
}
dev->driver = NULL; dev->driver = NULL;
usb_set_intfdata(iface, NULL); usb_set_intfdata(iface, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment