Skip to content

Commit

Permalink
usbip: Implement a match function to fix usbip
Browse files Browse the repository at this point in the history
Commit 88b7381a939d ("USB: Select better matching USB drivers when
available") introduced the use of a "match" function to select a
non-generic/better driver for a particular USB device. This
unfortunately breaks the operation of usbip in general, as reported in
the kernel bugzilla with bug 208267 (linked below).

Upon inspecting the aforementioned commit, one can observe that the
original code in the usb_device_match function used to return 1
unconditionally, but the aforementioned commit makes the usb_device_match
function use identifier tables and "match" virtual functions, if either of
them are available.

Hence, this commit implements a match function for usbip that
unconditionally returns true to ensure that usbip is functional again.

This change has been verified to restore usbip functionality, with a
v5.7.y kernel on an up-to-date version of Qubes OS 4.0, which uses
usbip to redirect USB devices between VMs.

Thanks to Jonathan Dieter for the effort in bisecting this issue down
to the aforementioned commit.

Fixes: 88b7381a939d ("USB: Select better matching USB drivers when available")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=208267
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1856443
Link: QubesOS/qubes-issues#5905
Signed-off-by: M. Vefa Bicakci <[email protected]>
Cc: <[email protected]> # 5.7
Cc: Valentina Manea <[email protected]>
Cc: Alan Stern <[email protected]>
Reviewed-by: Bastien Nocera <[email protected]>
Reviewed-by: Shuah Khan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
m-v-b authored and gregkh committed Aug 18, 2020
1 parent 3a3be6d commit 45375be
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ static void stub_disconnect(struct usb_device *udev)
return;
}

static bool usbip_match(struct usb_device *udev)
{
return true;
}

#ifdef CONFIG_PM

/* These functions need usb_port_suspend and usb_port_resume,
Expand All @@ -486,6 +491,7 @@ struct usb_device_driver stub_driver = {
.name = "usbip-host",
.probe = stub_probe,
.disconnect = stub_disconnect,
.match = usbip_match,
#ifdef CONFIG_PM
.suspend = stub_suspend,
.resume = stub_resume,
Expand Down

0 comments on commit 45375be

Please sign in to comment.