All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] USB: usbip: fix stub_dev hub disconnect
@ 2023-06-15  9:28 Jonas Blixt
  2023-10-05  7:22 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Jonas Blixt @ 2023-06-15  9:28 UTC (permalink / raw)
  To: shuah, valentina.manea.m
  Cc: gregkh, stern, linux-usb, linux-kernel, Jonas Blixt

If a hub is disconnected that has device(s) that's attached to the usbip layer
the disconnect function might fail because it tries to release the port
on an already disconnected hub.

Fixes: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices")
Signed-off-by: Jonas Blixt <jonas.blixt@actia.se>
---
v2:
 - Clarify comment
v1:
 Link to v1: https://lore.kernel.org/linux-usb/20230615092205.GA1212960@W388ANL/T/#m575e37dc404067797eadf4444857366c73ba3420
---
 drivers/usb/usbip/stub_dev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index 2305d425e6c9..2170c95c8dab 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -427,8 +427,13 @@ static void stub_disconnect(struct usb_device *udev)
 	/* release port */
 	rc = usb_hub_release_port(udev->parent, udev->portnum,
 				  (struct usb_dev_state *) udev);
-	if (rc) {
-		dev_dbg(&udev->dev, "unable to release port\n");
+	/*
+	 * NOTE: If a HUB disconnect triggered disconnect of the down stream
+	 * device usb_hub_release_port will return -ENODEV so we can safely ignore
+	 * that error here.
+	 */
+	if (rc && (rc != -ENODEV)) {
+		dev_dbg(&udev->dev, "unable to release port (%i)\n", rc);
 		return;
 	}
 
-- 
2.25.1


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

* Re: [PATCH v2] USB: usbip: fix stub_dev hub disconnect
  2023-06-15  9:28 [PATCH v2] USB: usbip: fix stub_dev hub disconnect Jonas Blixt
@ 2023-10-05  7:22 ` Greg KH
  2023-10-05 14:33   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2023-10-05  7:22 UTC (permalink / raw)
  To: Jonas Blixt; +Cc: shuah, valentina.manea.m, stern, linux-usb, linux-kernel

On Thu, Jun 15, 2023 at 11:28:10AM +0200, Jonas Blixt wrote:
> If a hub is disconnected that has device(s) that's attached to the usbip layer
> the disconnect function might fail because it tries to release the port
> on an already disconnected hub.
> 
> Fixes: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices")
> Signed-off-by: Jonas Blixt <jonas.blixt@actia.se>
> ---
> v2:
>  - Clarify comment
> v1:
>  Link to v1: https://lore.kernel.org/linux-usb/20230615092205.GA1212960@W388ANL/T/#m575e37dc404067797eadf4444857366c73ba3420
> ---
>  drivers/usb/usbip/stub_dev.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
> index 2305d425e6c9..2170c95c8dab 100644
> --- a/drivers/usb/usbip/stub_dev.c
> +++ b/drivers/usb/usbip/stub_dev.c
> @@ -427,8 +427,13 @@ static void stub_disconnect(struct usb_device *udev)
>  	/* release port */
>  	rc = usb_hub_release_port(udev->parent, udev->portnum,
>  				  (struct usb_dev_state *) udev);
> -	if (rc) {
> -		dev_dbg(&udev->dev, "unable to release port\n");
> +	/*
> +	 * NOTE: If a HUB disconnect triggered disconnect of the down stream
> +	 * device usb_hub_release_port will return -ENODEV so we can safely ignore
> +	 * that error here.
> +	 */
> +	if (rc && (rc != -ENODEV)) {
> +		dev_dbg(&udev->dev, "unable to release port (%i)\n", rc);
>  		return;
>  	}
>  
> -- 
> 2.25.1
> 

Shuah, what ever happened to this change, is it correct or was something
else applied to fix it?

thanks,

greg k-h

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

* Re: [PATCH v2] USB: usbip: fix stub_dev hub disconnect
  2023-10-05  7:22 ` Greg KH
@ 2023-10-05 14:33   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2023-10-05 14:33 UTC (permalink / raw)
  To: Greg KH, Jonas Blixt
  Cc: shuah, valentina.manea.m, stern, linux-usb, linux-kernel, Shuah Khan

On 10/5/23 01:22, Greg KH wrote:
> On Thu, Jun 15, 2023 at 11:28:10AM +0200, Jonas Blixt wrote:
>> If a hub is disconnected that has device(s) that's attached to the usbip layer
>> the disconnect function might fail because it tries to release the port
>> on an already disconnected hub.
>>
>> Fixes: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices")
>> Signed-off-by: Jonas Blixt <jonas.blixt@actia.se>
>> ---
>> v2:
>>   - Clarify comment
>> v1:
>>   Link to v1: https://lore.kernel.org/linux-usb/20230615092205.GA1212960@W388ANL/T/#m575e37dc404067797eadf4444857366c73ba3420
>> ---
>>   drivers/usb/usbip/stub_dev.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
>> index 2305d425e6c9..2170c95c8dab 100644
>> --- a/drivers/usb/usbip/stub_dev.c
>> +++ b/drivers/usb/usbip/stub_dev.c
>> @@ -427,8 +427,13 @@ static void stub_disconnect(struct usb_device *udev)
>>   	/* release port */
>>   	rc = usb_hub_release_port(udev->parent, udev->portnum,
>>   				  (struct usb_dev_state *) udev);
>> -	if (rc) {
>> -		dev_dbg(&udev->dev, "unable to release port\n");
>> +	/*
>> +	 * NOTE: If a HUB disconnect triggered disconnect of the down stream
>> +	 * device usb_hub_release_port will return -ENODEV so we can safely ignore
>> +	 * that error here.
>> +	 */
>> +	if (rc && (rc != -ENODEV)) {
>> +		dev_dbg(&udev->dev, "unable to release port (%i)\n", rc);
>>   		return;
>>   	}
>>   
>> -- 
>> 2.25.1
>>
> 
> Shuah, what ever happened to this change, is it correct or was something
> else applied to fix it?
> 

Sorry for the delay. I thought I took care of acking this one. :(

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

thanks,
-- Shuah


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

end of thread, other threads:[~2023-10-05 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-15  9:28 [PATCH v2] USB: usbip: fix stub_dev hub disconnect Jonas Blixt
2023-10-05  7:22 ` Greg KH
2023-10-05 14:33   ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.