Skip to content

Commit e534c5b

Browse files
AlanSterngregkh
authored andcommitted
USB: fix regression occurring during device removal
This patch (as1476) fixes a regression introduced by fccf4e8 (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: Alan Stern <[email protected]> Tested-by: Sarah Sharp <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3140d5b commit e534c5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/core/message.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
12861286
interface);
12871287
return -EINVAL;
12881288
}
1289+
if (iface->unregistering)
1290+
return -ENODEV;
12891291

12901292
alt = usb_altnum_to_altsetting(iface, alternate);
12911293
if (!alt) {

0 commit comments

Comments
 (0)