Hi,

With 2.6.11 and 2.6.12-rc2 (and perhaps a few versions before) usb
drivers for multi-interface devices, which do
usb_driver_release_interface() in their disconnect(), make rmmod hang.

It turns out to be due to a bug in drivers/base/bus.c:driver_detach(),
that iterates over the list of attached devices with
list_for_each_safe() under an assumption that device_release_driver()
only releases the current device, while it may also call
device_release_driver() for other devices on the same list.

The following patch fixes it.  Please consider applying.

P.S. Similar thing for -mm tree with klists will be discussed
in another mail.

Signed-off-by: Roman Kagan <[EMAIL PROTECTED]>

 bus.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

--- linux-2.6.12-rc2/drivers/base/bus.c.orig    2005-03-18 04:34:06.000000000 
+0300
+++ linux-2.6.12-rc2/drivers/base/bus.c 2005-04-13 08:45:48.000000000 +0400
@@ -405,9 +405,8 @@ void device_release_driver(struct device
 
 static void driver_detach(struct device_driver * drv)
 {
-       struct list_head * entry, * next;
-       list_for_each_safe(entry, next, &drv->devices) {
-               struct device * dev = container_of(entry, struct device, 
driver_list);
+       while (!list_empty(&drv->devices)) {
+               struct device * dev = container_of(drv->devices.next, struct 
device, driver_list);
                device_release_driver(dev);
        }
 }


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
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