Skip to contentSkip to conversation

usbip: Implement a match function to fix usbip

PATCH Superseded M. Vefa Bicakci 4 participants 5 messages Aug 10, 2020 – Aug 12, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usbip: Implement a match function to fix usbip

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")
Cc Valentina Manea <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Bastien Nocera <[email protected]>
Cc Alan Stern <[email protected]>
---
 drivers/usb/usbip/stub_dev.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/usb/usbip/stub_dev.c +6 -0
index 2305d425e6c9..9d7d642022d1 100644
@@ -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,
@@ -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,
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · M. Vefa Bicakci

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.

Quoted 6 lines

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.

Looks correct. Thanks for root causing the problem.

Quoted 42 lines
Fixes 88b7381a939d ("USB: Select better matching USB drivers when

available")

---
 drivers/usb/usbip/stub_dev.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/usb/usbip/stub_dev.c +5 -0
index 2305d425e6c9..9d7d642022d1 100644
@@ -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,

drivers/usb/usbip/stub_dev.c +1 -0
@@ -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,
maintainer Reviewed-by
#2 lore raw
Quoted 24 lines · Bastien Nocera
Quoted 23 lines · M. Vefa Bicakci

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.

Quoted 7 lines
Quoted 2 lines

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

Looks correct. Thanks for root causing the problem.

Thank you for finding and fixing the problem.

thanks,
-- Shuah

#3 lore raw
Quoted 28 lines · Shuah Khan
Quoted 27 lines · Bastien Nocera
Quoted 25 lines · M. Vefa Bicakci

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.

Quoted 8 lines
Quoted 4 lines

Looks correct. Thanks for root causing the problem.

Thank you for finding and fixing the problem.

Hello Shuah and Bastien,

Thank you for reviewing the patch!

Just to confirm, should I re-publish this patch after having added your Reviewed-by tags to the commit message? My current understanding is that a re-spin of a patch is only necessary when changes are requested during the code review. The development process documentation in the kernel repository does not mention this aspect, but I might have missed it during my quick search.

Thanks again,

Vefa

#4 lore raw
Quoted 40 lines · M. Vefa Bicakci
Quoted 28 lines · Shuah Khan
Quoted 27 lines · Bastien Nocera
Quoted 25 lines · M. Vefa Bicakci

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.

Quoted 8 lines
Quoted 4 lines

Looks correct. Thanks for root causing the problem.

Thank you for finding and fixing the problem.

Hello Shuah and Bastien,

Quoted 8 lines

Thank you for reviewing the patch!

Just to confirm, should I re-publish this patch after having added your Reviewed-by tags to the commit message? My current understanding is that a re-spin of a patch is only necessary when changes are requested during the code review. The development process documentation in the kernel repository does not mention this aspect, but I might have missed it during my quick search.

No need to resend it, my tools will pick up these reviewed-by tags and add it to the final patch when I apply it.

See the tool 'b4' if you are curious as to how that works.

thanks,

greg k-h