linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: Implement a match function to fix usbip
@ 2020-08-10 16:00 M. Vefa Bicakci
  2020-08-10 17:31 ` Bastien Nocera
  0 siblings, 1 reply; 5+ messages in thread
From: M. Vefa Bicakci @ 2020-08-10 16:00 UTC (permalink / raw)
  To: linux-usb
  Cc: M. Vefa Bicakci, stable, Valentina Manea, Shuah Khan,
	Greg Kroah-Hartman, Bastien Nocera, Alan Stern

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: https://github.com/QubesOS/qubes-issues/issues/5905
Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
Cc: <stable@vger.kernel.org> # 5.7
Cc: Valentina Manea <valentina.manea.m@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bastien Nocera <hadess@hadess.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/usb/usbip/stub_dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index 2305d425e6c9..9d7d642022d1 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -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,
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usbip: Implement a match function to fix usbip
  2020-08-10 16:00 [PATCH] usbip: Implement a match function to fix usbip M. Vefa Bicakci
@ 2020-08-10 17:31 ` Bastien Nocera
  2020-08-10 19:09   ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien Nocera @ 2020-08-10 17:31 UTC (permalink / raw)
  To: M. Vefa Bicakci, linux-usb
  Cc: stable, Valentina Manea, Shuah Khan, Greg Kroah-Hartman, Alan Stern

On Mon, 2020-08-10 at 19:00 +0300, M. Vefa Bicakci wrote:
> 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.

Looks correct. Thanks for root causing the problem.

Reviewed-by: Bastien Nocera <hadess@hadess.net>

> 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: https://github.com/QubesOS/qubes-issues/issues/5905
> Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
> Cc: <stable@vger.kernel.org> # 5.7
> Cc: Valentina Manea <valentina.manea.m@gmail.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Bastien Nocera <hadess@hadess.net>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> ---
>  drivers/usb/usbip/stub_dev.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/usbip/stub_dev.c
> b/drivers/usb/usbip/stub_dev.c
> index 2305d425e6c9..9d7d642022d1 100644
> --- a/drivers/usb/usbip/stub_dev.c
> +++ b/drivers/usb/usbip/stub_dev.c
> @@ -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,


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usbip: Implement a match function to fix usbip
  2020-08-10 17:31 ` Bastien Nocera
@ 2020-08-10 19:09   ` Shuah Khan
  2020-08-12  5:47     ` M. Vefa Bicakci
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2020-08-10 19:09 UTC (permalink / raw)
  To: Bastien Nocera, M. Vefa Bicakci, linux-usb
  Cc: stable, Valentina Manea, Shuah Khan, Greg Kroah-Hartman,
	Alan Stern, Shuah Khan

On 8/10/20 11:31 AM, Bastien Nocera wrote:
> On Mon, 2020-08-10 at 19:00 +0300, M. Vefa Bicakci wrote:
>> 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.
> 
> Looks correct. Thanks for root causing the problem.
> 
> Reviewed-by: Bastien Nocera <hadess@hadess.net>
> 

Thank you for finding and fixing the problem.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usbip: Implement a match function to fix usbip
  2020-08-10 19:09   ` Shuah Khan
@ 2020-08-12  5:47     ` M. Vefa Bicakci
  2020-08-12  6:16       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: M. Vefa Bicakci @ 2020-08-12  5:47 UTC (permalink / raw)
  To: Shuah Khan, Bastien Nocera, linux-usb
  Cc: stable, Valentina Manea, Greg Kroah-Hartman, Alan Stern, Shuah Khan

On 10/08/2020 22.09, Shuah Khan wrote:
> On 8/10/20 11:31 AM, Bastien Nocera wrote:
>> On Mon, 2020-08-10 at 19:00 +0300, M. Vefa Bicakci wrote:
>>> 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.
>>
>> Looks correct. Thanks for root causing the problem.
>>
>> Reviewed-by: Bastien Nocera <hadess@hadess.net>
>>
> 
> Thank you for finding and fixing the problem.
> 
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usbip: Implement a match function to fix usbip
  2020-08-12  5:47     ` M. Vefa Bicakci
@ 2020-08-12  6:16       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-08-12  6:16 UTC (permalink / raw)
  To: M. Vefa Bicakci
  Cc: Shuah Khan, Bastien Nocera, linux-usb, stable, Valentina Manea,
	Alan Stern, Shuah Khan

On Wed, Aug 12, 2020 at 08:47:20AM +0300, M. Vefa Bicakci wrote:
> On 10/08/2020 22.09, Shuah Khan wrote:
> > On 8/10/20 11:31 AM, Bastien Nocera wrote:
> > > On Mon, 2020-08-10 at 19:00 +0300, M. Vefa Bicakci wrote:
> > > > 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.
> > > 
> > > Looks correct. Thanks for root causing the problem.
> > > 
> > > Reviewed-by: Bastien Nocera <hadess@hadess.net>
> > > 
> > 
> > Thank you for finding and fixing the problem.
> > 
> > Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-12  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 16:00 [PATCH] usbip: Implement a match function to fix usbip M. Vefa Bicakci
2020-08-10 17:31 ` Bastien Nocera
2020-08-10 19:09   ` Shuah Khan
2020-08-12  5:47     ` M. Vefa Bicakci
2020-08-12  6:16       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).