linux/drivers/usb/core
Alan Stern e16362a0c8 USB: fix possible deadlock involving sysfs attributes
There is a potential deadlock when the usb_generic driver is unbound
from a device.  The problem is that generic_disconnect() is called
with the device lock held, and it removes a bunch of device attributes
from sysfs.  If a user task happens to be running an attribute method
at the time, the removal will block until the method returns.  But at
least one of the attribute methods (the store routine for power/level)
needs to acquire the device lock!

This patch (as1093) eliminates the deadlock by moving the calls to
create and remove the sysfs attributes from the usb_generic driver
into usb_new_device() and usb_disconnect(), where they can be invoked
without holding the device lock.

Besides, the other sysfs attributes are created when the device is
registered and removed when the device is unregistered.  So it seems
only fitting for the extra attributes to be created and removed at the
same time.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-05-29 13:59:03 -07:00
..
buffer.c USB: fix codingstyle issues in drivers/usb/core/*.c 2008-02-01 14:35:08 -08:00
config.c USB: ehci tolerates some buggy devices 2008-04-24 21:16:35 -07:00
devices.c USB: fix codingstyle issues in drivers/usb/core/devices.c 2008-02-01 14:35:07 -08:00
devio.c USB: replace remaining __FUNCTION__ occurrences 2008-04-24 21:16:55 -07:00
driver.c USB: replace remaining __FUNCTION__ occurrences 2008-04-24 21:16:55 -07:00
endpoint.c USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00
file.c USB: mark USB drivers as being GPL only 2008-02-01 14:35:07 -08:00
generic.c USB: fix possible deadlock involving sysfs attributes 2008-05-29 13:59:03 -07:00
hcd-pci.c USB: clarify usage of hcd->suspend/resume methods 2008-04-24 21:16:48 -07:00
hcd.c USB: Core: fix race in device_create 2008-05-20 13:31:56 -07:00
hcd.h USB: don't explicitly reenable root-hub status interrupts 2008-04-24 21:16:53 -07:00
hub.c USB: fix possible deadlock involving sysfs attributes 2008-05-29 13:59:03 -07:00
hub.h wusb: make ep0_reinit available for modules 2008-04-24 21:16:59 -07:00
inode.c proc: remove proc_bus 2008-04-29 08:06:18 -07:00
Kconfig USB: Remove EXPERIMENTAL from dynamic USB minor allocation. 2008-04-24 21:16:43 -07:00
Makefile USB: add a blacklist for devices that can't handle some things we throw at them. 2007-02-23 15:03:46 -08:00
message.c USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00
notify.c USB : correct comments in usb/core/notify.c 2008-02-01 14:34:44 -08:00
otg_whitelist.h USB: fix codingstyle issues in drivers/usb/core/*.h 2008-02-01 14:35:07 -08:00
quirks.c USB: enable USB-PERSIST by default 2008-04-24 21:16:33 -07:00
sysfs.c USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00
urb.c USB: replace remaining __FUNCTION__ occurrences 2008-04-24 21:16:55 -07:00
usb.c USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00
usb.h USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00