linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: fix usbip attach to find a port that matches the requested speed
@ 2017-11-29 22:24 Shuah Khan
  2017-11-30  8:20 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2017-11-29 22:24 UTC (permalink / raw)
  To: shuah, valentina.manea.m
  Cc: Shuah Khan, gregkh, yuyang.du, k.opasiak, kstewart, linux-usb,
	linux-kernel, juan.zea

usbip attach fails to find a free port when the device on the first port
is a USB_SPEED_SUPER device and non-super speed device is being attached.
It keeps checking the first port and returns without a match getting stuck
in a loop.

Fix it check to find the first port with matching speed.

Reported-by: Juan Zea <juan.zea@qindel.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/usb/usbip/libsrc/vhci_driver.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
index 5727dfb15a83..8a1cd1616de4 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -329,9 +329,17 @@ int usbip_vhci_refresh_device_list(void)
 int usbip_vhci_get_free_port(uint32_t speed)
 {
 	for (int i = 0; i < vhci_driver->nports; i++) {
-		if (speed == USB_SPEED_SUPER &&
-		    vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
-			continue;
+
+		switch (speed) {
+		case	USB_SPEED_SUPER:
+			if (vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
+				continue;
+		break;
+		default:
+			if (vhci_driver->idev[i].hub != HUB_SPEED_HIGH)
+				continue;
+		break;
+		}
 
 		if (vhci_driver->idev[i].status == VDEV_ST_NULL)
 			return vhci_driver->idev[i].port;
-- 
2.14.1

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

* Re: [PATCH] usbip: fix usbip attach to find a port that matches the requested speed
  2017-11-29 22:24 [PATCH] usbip: fix usbip attach to find a port that matches the requested speed Shuah Khan
@ 2017-11-30  8:20 ` Greg KH
  2017-11-30 14:56   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2017-11-30  8:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: shuah, valentina.manea.m, yuyang.du, k.opasiak, kstewart,
	linux-usb, linux-kernel, juan.zea

On Wed, Nov 29, 2017 at 03:24:22PM -0700, Shuah Khan wrote:
> usbip attach fails to find a free port when the device on the first port
> is a USB_SPEED_SUPER device and non-super speed device is being attached.
> It keeps checking the first port and returns without a match getting stuck
> in a loop.
> 
> Fix it check to find the first port with matching speed.
> 
> Reported-by: Juan Zea <juan.zea@qindel.com>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  tools/usb/usbip/libsrc/vhci_driver.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)

Does this need to go to the stable trees?

thanks,

greg k-h

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

* Re: [PATCH] usbip: fix usbip attach to find a port that matches the requested speed
  2017-11-30  8:20 ` Greg KH
@ 2017-11-30 14:56   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2017-11-30 14:56 UTC (permalink / raw)
  To: Greg KH, Shuah Khan
  Cc: valentina.manea.m, yuyang.du, k.opasiak, kstewart, linux-usb,
	linux-kernel, juan.zea, Shuah Khan, Shuah Khan

On 11/30/2017 01:20 AM, Greg KH wrote:
> On Wed, Nov 29, 2017 at 03:24:22PM -0700, Shuah Khan wrote:
>> usbip attach fails to find a free port when the device on the first port
>> is a USB_SPEED_SUPER device and non-super speed device is being attached.
>> It keeps checking the first port and returns without a match getting stuck
>> in a loop.
>>
>> Fix it check to find the first port with matching speed.
>>
>> Reported-by: Juan Zea <juan.zea@qindel.com>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  tools/usb/usbip/libsrc/vhci_driver.c | 14 +++++++++++---
>>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> Does this need to go to the stable trees?
> 

Yes it does. I forgot to tag this for stable. There is another
one from Yuyang Du that needs to go into stable. I am just about
to Ack that. These need to go tino 4.13 as well, but looks like
4.13 is all done now. So definitely for 4.14

[PATCH] usbip: Fix USB device hang due to wrong enabling of scatter-gather

thanks,
-- Shuah

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

end of thread, other threads:[~2017-11-30 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 22:24 [PATCH] usbip: fix usbip attach to find a port that matches the requested speed Shuah Khan
2017-11-30  8:20 ` Greg KH
2017-11-30 14:56   ` 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).