Bug 208267

Summary: usbip broken with latest kernels?
Product: Drivers Reporter: DocMAX (forum)
Component: USBAssignee: Default virtual assignee for Drivers/USB (drivers_usb)
Status: RESOLVED CODE_FIX    
Severity: normal CC: greg, jdieter, justin, kernel, m.v.b, spam, thomas.perret+kernel
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: Linux t420 5.7.4-arch1-1 #1 SMP PREEMPT Thu, 18 Jun 2020 16:01:07 +0000 x86_64 GNU/Linux Subsystem:
Regression: No Bisected commit-id:

Description DocMAX 2020-06-21 13:57:09 UTC
[root@t420]: /home/docmax># usbip list -l
 - busid 1-1.1 (0572:6831)
   Conexant Systems (Rockwell), Inc. : DVBSky S960 DVB-S2 tuner (0572:6831)

 - busid 1-1.2.3 (057e:0306)
   Nintendo Co., Ltd : Wii Remote Controller RVL-003 (057e:0306)

 - busid 1-1.2.4 (045e:0719)
   Microsoft Corp. : Xbox 360 Wireless Adapter (045e:0719)

 - busid 1-1.3 (147e:2016)
   Upek : Biometric Touchchip/Touchstrip Fingerprint Sensor (147e:2016)

 - busid 1-1.4 (0a5c:217f)
   Broadcom Corp. : BCM2045B (BDC-2.1) (0a5c:217f)

 - busid 1-1.6 (04f2:b221)
   Chicony Electronics Co., Ltd : integrated camera (04f2:b221)

 - busid 4-1 (152d:0567)
   JMicron Technology Corp. / JMicron USA Technology Corp. : JMS567 SATA 6Gb/s bridge (152d:0567)

 - busid 4-2 (152d:0567)
   JMicron Technology Corp. / JMicron USA Technology Corp. : JMS567 SATA 6Gb/s bridge (152d:0567)

 - busid 3-1.2 (174c:5136)
   ASMedia Technology Inc. : ASM1053 SATA 3Gb/s bridge (174c:5136)

[root@t420]: /home/docmax># usbip -d bind -b 1-1.2.4
usbip: debug: usbip.c:129:[run_command] running command: `bind'
usbip: debug: sysfs_utils.c:24:[write_sysfs_attribute] error writing to attribute /sys/bus/usb/drivers/usbip-host/bind
usbip: error: error binding device 1-1.2.4 to driver: No such device
usbip: error: could not bind device to usbip-host
Comment 1 DocMAX 2020-06-21 14:52:33 UTC
Just found out: The problem begins with kernel 5.7!
Comment 2 gregkh 2020-06-21 15:20:22 UTC
On Sun, Jun 21, 2020 at 02:52:33PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208267
> 
> --- Comment #1 from DocMAX (forum@docmax.my.to) ---
> Just found out: The problem begins with kernel 5.7!

Does 5.6 work?  Any chance you can use 'git bisect' to find the
offending commit?

thanks,

greg k-h
Comment 3 DocMAX 2020-06-21 17:03:25 UTC
yes 5.6 works. as i said, starts with 5.7.
i haven't much experience with git bisect. need some guidance.
Comment 4 Greg Kroah-Hartman 2020-06-22 08:04:31 UTC
On Sun, Jun 21, 2020 at 05:03:25PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208267
> 
> --- Comment #3 from DocMAX (forum@docmax.my.to) ---
> yes 5.6 works. as i said, starts with 5.7.
> i haven't much experience with git bisect. need some guidance.

the man page for git bisect should have lots of guidance, see
	man git bisect
for the details.

To start, do:
	git bisect start
	git bisect good v5.6
	git bisect bad v5.7
and then follow the prompts from there, building and booting the
resulting kernel and saying 'good' or 'bad' depending on what happened.

If you have specific questions about this, please let us know.
Comment 5 M. Vefa Bicakci 2020-06-28 22:48:20 UTC
Hello all,

I can confirm that reverting the following five commits resolves the reported issue with usbip, at least on Qubes OS, which uses usbip to redirect/reattach USB devices between VMs running on Xen.

* ef0f7d1877ac ("USB: Export generic USB device driver functions")
* c9d503370f24 ("USB: Make it possible to "subclass" usb_device_driver")
* aeebf2b54665 ("USB: Implement usb_device_match_id()")
* 88b7381a939d ("USB: Select better matching USB drivers when available")
* 77419aa403ca ("USB: Fallback to generic driver when specific driver fails")

Thank you,

Vefa
Comment 6 Jonathan Dieter 2020-07-19 21:29:52 UTC
FWIW, I've had this reported in Fedora as well: https://bugzilla.redhat.com/show_bug.cgi?id=1856443
Comment 7 Greg Kroah-Hartman 2020-07-20 06:57:14 UTC
On Sun, Jul 19, 2020 at 09:29:52PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208267
> 
> Jonathan Dieter (jdieter@gmail.com) changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |jdieter@gmail.com
> 
> --- Comment #6 from Jonathan Dieter (jdieter@gmail.com) ---
> FWIW, I've had this reported in Fedora as well:
> https://bugzilla.redhat.com/show_bug.cgi?id=1856443

Any chance someone can run 'git bisect' to find the offending commit?
Comment 8 Jonathan Dieter 2020-07-20 07:15:31 UTC
Sure, if commits in comment #5 aren't specific enough, I'll see if I can get a chance to run 'git bisect' this evening.
Comment 9 Jonathan Dieter 2020-07-21 11:38:02 UTC
git bisect gives me the following:
88b7381a939de0fa1f1b1629c56b03dca7077309 is the first bad commit
commit 88b7381a939de0fa1f1b1629c56b03dca7077309
Author: Bastien Nocera <hadess@hadess.net>
Date:   Wed Oct 16 11:39:31 2019 +0200

    USB: Select better matching USB drivers when available
    
    Now that USB device drivers can reuse code from the generic USB device
    driver, we need to make sure that they get selected rather than the
    generic driver. Add an id_table and match vfunc to the usb_device_driver
    struct, which will get used to select a better matching driver at
    ->probe time.
    
    This is a similar mechanism to that used in the HID drivers, with the
    generic driver being selected unless there's a better matching one found
    in the registered drivers (see hid_generic_match() in
    drivers/hid/hid-generic.c).
    
    Signed-off-by: Bastien Nocera <hadess@hadess.net>
    Acked-by: Alan Stern <stern@rowland.harvard.edu>
    Link: https://lore.kernel.org/r/20191016093933.693-5-hadess@hadess.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 drivers/usb/core/driver.c  | 15 +++++++++++++--
 drivers/usb/core/generic.c | 29 +++++++++++++++++++++++++++++
 include/linux/usb.h        |  2 ++
 3 files changed, 44 insertions(+), 2 deletions(-)
Comment 10 M. Vefa Bicakci 2020-08-27 20:37:54 UTC
Hello all,

I just wanted to let all of the subscribers to this bug know that a patch that I prepared to resolve this issue was committed to Greg Kroah-Hartman's git tree for the USB subsystem. Sorry for the silence on my end.

Here is a link to the commit:

  https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-linus&id=7a2f2974f26542b4e7b9b4321edb3cbbf3eeb91a


I had already verified that the linked patch resolves this bug with USB-IP on Qubes OS, but it would be beneficial/desirable for others to verify this.

I would also like to thank Jonathan Dieter for bisecting this issue to a specific commit, which was very helpful in preparing the committed patch.
Comment 11 David Rohr 2020-08-28 20:46:44 UTC
I just compiled 5.8.5 with your patch and usbip works correctly, thx!
Comment 12 DocMAX 2020-09-01 10:41:28 UTC
Just a side-question: Can things like this happen on LTS versions of the kernel?
Comment 13 Greg Kroah-Hartman 2020-09-01 14:06:34 UTC
On Tue, Sep 01, 2020 at 10:41:28AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208267
> 
> --- Comment #12 from DocMAX (forum@docmax.my.to) ---
> Just a side-question: Can things like this happen on LTS versions of the
> kernel?

"things" like what?

Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html

for the rules of what type of patches are allowed in the stable kernel
trees.

thanks,

greg k-h
Comment 14 DocMAX 2020-09-01 14:18:17 UTC
things = breaking functionality of well known programs that are even integrated in the kernel.
Comment 15 Greg Kroah-Hartman 2020-09-01 14:52:20 UTC
On Tue, Sep 01, 2020 at 02:18:17PM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208267
> 
> --- Comment #14 from DocMAX (forum@docmax.my.to) ---
> things = breaking functionality of well known programs that are even
> integrated
> in the kernel.

Bugs happen, we are human :)
Comment 16 M. Vefa Bicakci 2020-09-05 12:56:27 UTC
Hello David,

I realize that this is a bit late, but thanks for the feedback confirming that USB-IP functionality is restored with the patch!

Hello Greg and DocMAX,

Given that Greg has recently released Linux v5.8.6 with the commit fixing this issue (thanks!), would it be possible for one of you to close this bug? (Sorry making this administration request; I logged in with the intention of closing this bug, but it appears that I do not have the permission to do so.)