Commit e534c5b8 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: fix regression occurring during device removal

This patch (as1476) fixes a regression introduced by
fccf4e86 (USB: Free bandwidth when
usb_disable_device is called).  usb_disconnect() grabs the
bandwidth_mutex before calling usb_disable_device(), which calls down
indirectly to usb_set_interface(), which tries to acquire the
bandwidth_mutex.

The fix causes usb_set_interface() to return early when it is called
for an interface that has already been unregistered, which is what
happens in usb_disable_device().
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Tested-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3140d5b2
...@@ -1286,6 +1286,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) ...@@ -1286,6 +1286,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
interface); interface);
return -EINVAL; return -EINVAL;
} }
if (iface->unregistering)
return -ENODEV;
alt = usb_altnum_to_altsetting(iface, alternate); alt = usb_altnum_to_altsetting(iface, alternate);
if (!alt) { if (!alt) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment