[PATCH] drivers/base/bus.c: fix iteration in driver_detach()
authorRoman Kagan <rkagan@mail.ru>
Wed, 13 Apr 2005 17:40:17 +0000 (21:40 +0400)
committerGreg KH <gregkh@suse.de>
Thu, 5 May 2005 06:44:38 +0000 (23:44 -0700)
commitb2d84f078a8be40f5ae3b4d2ac001e2a7f45fe4f
tree173f941991f1b68da820e9926a3b7ebdd3a2c8b9
parent177a4324944478f2799ce4ede2797cb0f602f274
[PATCH] drivers/base/bus.c: fix iteration in driver_detach()

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.

Signed-off-by: Roman Kagan <rkagan@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/bus.c