Commit 97475763 authored by Jonas Blixt's avatar Jonas Blixt Committed by Greg Kroah-Hartman

USB: usbip: fix stub_dev hub disconnect

If a hub is disconnected that has device(s) that's attached to the usbip layer
the disconnect function might fail because it tries to release the port
on an already disconnected hub.

Fixes: 6080cd0e ("staging: usbip: claim ports used by shared devices")
Signed-off-by: default avatarJonas Blixt <jonas.blixt@actia.se>
Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230615092810.1215490-1-jonas.blixt@actia.seSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1053c4a4
......@@ -464,8 +464,13 @@ static void stub_disconnect(struct usb_device *udev)
/* release port */
rc = usb_hub_release_port(udev->parent, udev->portnum,
(struct usb_dev_state *) udev);
if (rc) {
dev_dbg(&udev->dev, "unable to release port\n");
/*
* NOTE: If a HUB disconnect triggered disconnect of the down stream
* device usb_hub_release_port will return -ENODEV so we can safely ignore
* that error here.
*/
if (rc && (rc != -ENODEV)) {
dev_dbg(&udev->dev, "unable to release port (%i)\n", rc);
return;
}
......
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