summaryrefslogtreecommitdiffstats
path: root/drivers/usb/usbip
diff options
context:
space:
mode:
authorJonas Blixt <jonas.blixt@actia.se>2023-06-15 11:28:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-08 07:49:17 +0200
commit97475763484245916735a1aa9a3310a01d46b008 (patch)
treea57ab510dc91762574f685bebc80c1868559ec1d /drivers/usb/usbip
parent1053c4a4b8fcbd28386e80347e7c82d4d617e352 (diff)
downloadlinux-97475763484245916735a1aa9a3310a01d46b008.tar.gz
linux-97475763484245916735a1aa9a3310a01d46b008.tar.bz2
linux-97475763484245916735a1aa9a3310a01d46b008.zip
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: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices") Signed-off-by: Jonas Blixt <jonas.blixt@actia.se> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20230615092810.1215490-1-jonas.blixt@actia.se Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/usbip')
-rw-r--r--drivers/usb/usbip/stub_dev.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index 9c6954aad6c8..ce625b1ce9a5 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -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;
}