diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-04-17 15:22:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-27 09:51:08 -0700 |
commit | 5eb68e665cadf165741a04c695a71cff11e1d4f1 (patch) | |
tree | 7947e1ddc3af613bceccaddfb2e51b8367f2a802 /Documentation/ia64/mca.txt | |
parent | 3599fbb407dfa09d1d8d1507961fa03088c3b695 (diff) | |
download | kernel_samsung_smdk4412-5eb68e665cadf165741a04c695a71cff11e1d4f1.tar.gz kernel_samsung_smdk4412-5eb68e665cadf165741a04c695a71cff11e1d4f1.tar.bz2 kernel_samsung_smdk4412-5eb68e665cadf165741a04c695a71cff11e1d4f1.zip |
USB: fix deadlock in bConfigurationValue attribute method
commit 8963c487a80b4688c9e68dcc504a90074aacc145 upstream.
This patch (as154) fixes a self-deadlock that occurs when userspace
writes to the bConfigurationValue sysfs attribute for a hub with
children. The task tries to lock the bandwidth_mutex at a time when
it already owns the lock:
The attribute's method calls usb_set_configuration(),
which calls usb_disable_device() with the bandwidth_mutex
held.
usb_disable_device() unregisters the existing interfaces,
which causes the hub driver to be unbound.
The hub_disconnect() routine calls hub_quiesce(), which
calls usb_disconnect() for each of the hub's children.
usb_disconnect() attempts to acquire the bandwidth_mutex
around a call to usb_disable_device().
The solution is to make usb_disable_device() acquire the mutex for
itself instead of requiring the caller to hold it. Then the mutex can
cover only the bandwidth deallocation operation and not the region
where the interfaces are unregistered.
This has the potential to change system behavior slightly when a
config change races with another config or altsetting change. Some of
the bandwidth released from the old config might get claimed by the
other config or altsetting, make it impossible to restore the old
config in case of a failure. But since we don't try to recover from
config-change failures anyway, this doesn't matter.
[This should be marked for stable kernels that contain the commit
fccf4e86200b8f5edd9a65da26f150e32ba79808 "USB: Free bandwidth when
usb_disable_device is called."
That commit was marked for stable kernels as old as 2.6.32.]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/ia64/mca.txt')
0 files changed, 0 insertions, 0 deletions