diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-05-20 16:37:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-29 16:59:03 -0400 |
commit | e16362a0c8d90e9adbfe477acbe32b021823fb22 (patch) | |
tree | 688efa40b57e8fdb56335f7c5844492026d090cf /drivers/macintosh/macio-adb.c | |
parent | 62d104d0deeabd4148e49eba729d963e740e205f (diff) |
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>
Diffstat (limited to 'drivers/macintosh/macio-adb.c')
0 files changed, 0 insertions, 0 deletions