OpenCloudOS-Kernel/drivers/usb/core
Thadeu Lima de Souza Cascardo 0791971ba8 usb: allow drivers to use allocated bandwidth until unbound
When using the remove sysfs file, the device configuration is set to -1
(unconfigured). This eventually unbind drivers with the bandwidth_mutex
held. Some drivers may call functions that hold said mutex, like
usb_reset_device. This is the case for rtl8187, for example. This will
lead to the same process holding the mutex twice, which deadlocks.

Besides, according to Alan Stern:
"The deadlock problem probably could be handled somehow, but there's a
separate issue: Until the usb_disable_device call finishes unbinding
the drivers, the drivers are free to continue using their allocated
bandwidth.  We musn't change the bandwidth allocations until after the
unbinding is done.  So this patch is indeed necessary."

Unbinding the driver before holding the bandwidth_mutex solves the
problem. If any operation after that fails, drivers are not bound again.
But that would be a problem anyway that the user may solve resetting the
device configuration to one that works, just like he would need to do in
most other failure cases.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-03 17:33:40 -07:00
..
Kconfig USB: fix build on OMAPs if CONFIG_PM_RUNTIME is not set 2010-04-30 09:25:11 -07:00
Makefile USB: add the usbfs devices file to debugfs 2009-06-15 21:44:43 -07:00
buffer.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
config.c USB: remove the usb_host_ss_ep_comp structure 2010-05-20 13:21:40 -07:00
devices.c USB: devices: fix Coding Styles 2010-05-20 13:21:38 -07:00
devio.c USB-BKL: Convert usb_driver ioctl to unlocked_ioctl 2010-08-10 14:35:35 -07:00
driver.c USB: remove fake "address-of" expressions 2010-08-10 14:35:45 -07:00
endpoint.c USB: core endpoint: Fix Coding Styles 2010-08-10 14:35:34 -07:00
file.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
generic.c USB: accept RNDIS configs if there's no alternative 2010-08-10 14:35:43 -07:00
hcd-pci.c USB: core: hcd-pci: use for_each_pci_dev() 2010-08-10 14:35:38 -07:00
hcd.c USB: xHCI: Supporting MSI/MSI-X 2010-08-10 14:35:40 -07:00
hub.c USB delay init quirk for logitech Harmony 700-series devices 2010-08-10 14:35:41 -07:00
inode.c USB-BKL: Remove lock_kernel in usbfs update_sb() 2010-08-10 14:35:35 -07:00
message.c usb: allow drivers to use allocated bandwidth until unbound 2010-09-03 17:33:40 -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 delay init quirk for logitech Harmony 700-series devices 2010-08-10 14:35:41 -07:00
sysfs.c sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
urb.c USB: fix thread-unsafe anchor utiliy routines 2010-08-10 14:35:45 -07:00
usb.c USB: remove fake "address-of" expressions 2010-08-10 14:35:45 -07:00
usb.h USB: convert to the runtime PM framework 2010-03-02 14:54:12 -08:00