linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: fix vhci_hcd controller counting
@ 2018-09-20 20:29 Maciej Żenczykowski
  2018-09-29  8:24 ` Maciej Żenczykowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maciej Żenczykowski @ 2018-09-20 20:29 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Linux Kernel Mailing List, Jonathan Dieter, Valentina Manea,
	Shuah Khan, linux-usb, Maciej Żenczykowski

From: Maciej Żenczykowski <maze@google.com>

Without this usbip fails on a machine with devices
that lexicographically come after vhci_hcd.

ie.
  $ ls -l /sys/devices/platform
  ...
  drwxr-xr-x. 4 root root    0 Sep 19 16:21 serial8250
  -rw-r--r--. 1 root root 4096 Sep 19 23:50 uevent
  drwxr-xr-x. 6 root root    0 Sep 20 13:15 vhci_hcd.0
  drwxr-xr-x. 4 root root    0 Sep 19 16:22 w83627hf.656

Because it detects 'w83627hf.656' as another vhci_hcd controller,
and then fails to be able to talk to it.

Note: this doesn't actually fix usbip's support for multiple
controllers... that's still broken for other reasons
("vhci_hcd.0" is hardcoded in a string macro), but is enough to
actually make it work on the above machine.

See also:
  https://bugzilla.redhat.com/show_bug.cgi?id=1631148

Cc: Jonathan Dieter <jdieter@gmail.com>
Cc: Valentina Manea <valentina.manea.m@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Maciej Żenczykowski <zenczykowski@gmail.com>
---
 tools/usb/usbip/libsrc/vhci_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
index 4204359c9fee..8159fd98680b 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -150,7 +150,7 @@ static int get_nports(struct udev_device *hc_device)
 
 static int vhci_hcd_filter(const struct dirent *dirent)
 {
-	return strcmp(dirent->d_name, "vhci_hcd") >= 0;
+	return !strncmp(dirent->d_name, "vhci_hcd.", 9);
 }
 
 static int get_ncontrollers(void)
-- 
2.19.0.444.g18242da7ef-goog


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

* Re: [PATCH] usbip: fix vhci_hcd controller counting
  2018-09-20 20:29 [PATCH] usbip: fix vhci_hcd controller counting Maciej Żenczykowski
@ 2018-09-29  8:24 ` Maciej Żenczykowski
  2018-09-29 10:47 ` Jonathan Dieter
  2018-10-01 19:11 ` Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Maciej Żenczykowski @ 2018-09-29  8:24 UTC (permalink / raw)
  To: Maciej Żenczykowski, Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Jonathan Dieter, Valentina Manea,
	Shuah Khan, linux-usb, Maciej Żenczykowski

I'm not entirely sure who I should be CC'ing on this... but it's such
an obvious fix...

Thanks,
- Maciej

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

* Re: [PATCH] usbip: fix vhci_hcd controller counting
  2018-09-20 20:29 [PATCH] usbip: fix vhci_hcd controller counting Maciej Żenczykowski
  2018-09-29  8:24 ` Maciej Żenczykowski
@ 2018-09-29 10:47 ` Jonathan Dieter
  2018-10-01 19:11 ` Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Dieter @ 2018-09-29 10:47 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski
  Cc: Linux Kernel Mailing List, Valentina Manea, Shuah Khan, linux-usb

For whatever it's worth, I've tested this on 4.18.9 and can verify that
there are no regressions there.

Tested-by: Jonathan Dieter <jdieter@gmail.com>


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

* Re: [PATCH] usbip: fix vhci_hcd controller counting
  2018-09-20 20:29 [PATCH] usbip: fix vhci_hcd controller counting Maciej Żenczykowski
  2018-09-29  8:24 ` Maciej Żenczykowski
  2018-09-29 10:47 ` Jonathan Dieter
@ 2018-10-01 19:11 ` Shuah Khan
  2 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2018-10-01 19:11 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski, Greg Kroah-Hartman
  Cc: Linux Kernel Mailing List, Jonathan Dieter, Valentina Manea,
	linux-usb, jdieter, Shuah Khan

On 09/20/2018 02:29 PM, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> Without this usbip fails on a machine with devices
> that lexicographically come after vhci_hcd.
> 
> ie.
>   $ ls -l /sys/devices/platform
>   ...
>   drwxr-xr-x. 4 root root    0 Sep 19 16:21 serial8250
>   -rw-r--r--. 1 root root 4096 Sep 19 23:50 uevent
>   drwxr-xr-x. 6 root root    0 Sep 20 13:15 vhci_hcd.0
>   drwxr-xr-x. 4 root root    0 Sep 19 16:22 w83627hf.656
> 
> Because it detects 'w83627hf.656' as another vhci_hcd controller,
> and then fails to be able to talk to it.
> 
> Note: this doesn't actually fix usbip's support for multiple
> controllers... that's still broken for other reasons
> ("vhci_hcd.0" is hardcoded in a string macro), but is enough to
> actually make it work on the above machine.
> 
> See also:
>   https://bugzilla.redhat.com/show_bug.cgi?id=1631148
> 
> Cc: Jonathan Dieter <jdieter@gmail.com>
> Cc: Valentina Manea <valentina.manea.m@gmail.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-usb@vger.kernel.org
> Signed-off-by: Maciej Żenczykowski <zenczykowski@gmail.com>
> ---
>  tools/usb/usbip/libsrc/vhci_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
> index 4204359c9fee..8159fd98680b 100644
> --- a/tools/usb/usbip/libsrc/vhci_driver.c
> +++ b/tools/usb/usbip/libsrc/vhci_driver.c
> @@ -150,7 +150,7 @@ static int get_nports(struct udev_device *hc_device)
>  
>  static int vhci_hcd_filter(const struct dirent *dirent)
>  {
> -	return strcmp(dirent->d_name, "vhci_hcd") >= 0;
> +	return !strncmp(dirent->d_name, "vhci_hcd.", 9);
>  }
>  
>  static int get_ncontrollers(void)
> 

Thanks for the patch. Looks good to me.

Greg! Can you please pick this up.

Acked-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>


thanks,
-- Shuah





thanks,
-- Shuah

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

end of thread, other threads:[~2018-10-01 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 20:29 [PATCH] usbip: fix vhci_hcd controller counting Maciej Żenczykowski
2018-09-29  8:24 ` Maciej Żenczykowski
2018-09-29 10:47 ` Jonathan Dieter
2018-10-01 19:11 ` Shuah Khan

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).