kernel-hacking-2024-linux-s.../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
config.c
devices.c
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
generic.c USB: fix possible deadlock involving sysfs attributes 2008-05-29 13:59:03 -07:00
hcd-pci.c
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
Makefile
message.c USB: create attributes before sending uevent 2008-05-14 10:00:26 -07:00
notify.c
otg_whitelist.h
quirks.c
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