linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: tools: update return status when failed
@ 2024-10-22  6:48 Zongmin Zhou
  2024-10-22  7:58 ` Hongren Zheng
  2024-10-23 18:59 ` Shuah Khan
  0 siblings, 2 replies; 6+ messages in thread
From: Zongmin Zhou @ 2024-10-22  6:48 UTC (permalink / raw)
  To: valentina.manea.m, shuah, i; +Cc: linux-usb, linux-kernel, Zongmin Zhou

From: Zongmin Zhou <zhouzongmin@kylinos.cn>

Have to set "ret" before return when found a invalid port.

Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
---
 tools/usb/usbip/src/usbip_detach.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index b29101986b5a..6b78d4a81e95 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -68,6 +68,7 @@ static int detach_port(char *port)
 	}
 
 	if (!found) {
+		ret = -1;
 		err("Invalid port %s > maxports %d",
 			port, vhci_driver->nports);
 		goto call_driver_close;
-- 
2.34.1


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

* Re: [PATCH] usbip: tools: update return status when failed
  2024-10-22  6:48 [PATCH] usbip: tools: update return status when failed Zongmin Zhou
@ 2024-10-22  7:58 ` Hongren Zheng
  2024-12-20 17:26   ` Shuah Khan
  2024-10-23 18:59 ` Shuah Khan
  1 sibling, 1 reply; 6+ messages in thread
From: Hongren Zheng @ 2024-10-22  7:58 UTC (permalink / raw)
  To: Zongmin Zhou
  Cc: valentina.manea.m, shuah, linux-usb, linux-kernel, Zongmin Zhou

On Tue, Oct 22, 2024 at 02:48:56PM +0800, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>
> 
> Have to set "ret" before return when found a invalid port.
> 
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>

Reviewed-by: Hongren Zheng <i@zenithal.me>

> ---
>  tools/usb/usbip/src/usbip_detach.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index b29101986b5a..6b78d4a81e95 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>  	}
>  
>  	if (!found) {
> +		ret = -1;
>  		err("Invalid port %s > maxports %d",
>  			port, vhci_driver->nports);
>  		goto call_driver_close;
> -- 
> 2.34.1
> 

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

* Re: [PATCH] usbip: tools: update return status when failed
  2024-10-22  6:48 [PATCH] usbip: tools: update return status when failed Zongmin Zhou
  2024-10-22  7:58 ` Hongren Zheng
@ 2024-10-23 18:59 ` Shuah Khan
  2024-10-24  2:27   ` [PATCH v2] usbip: tools: Fix detach_port() invalid port error path Zongmin Zhou
  1 sibling, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-10-23 18:59 UTC (permalink / raw)
  To: Zongmin Zhou, valentina.manea.m, shuah, i
  Cc: linux-usb, linux-kernel, Zongmin Zhou, Shuah Khan

On 10/22/24 00:48, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>

Update the short log to clearly indicate that this
is a fix:

usbip: tools: Fix detach_port() invalid port error path

> 
> Have to set "ret" before return when found a invalid port.

Give more details that detach_port() doesn't return error
when detach is attempted on an invalid port.

This is a fix for 40ecdeb1a1875
usbip: usbip_detach: fix to check for invalid ports

Add Fixes tag

This patch can be tagged for stable.

> 
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
> ---
>   tools/usb/usbip/src/usbip_detach.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index b29101986b5a..6b78d4a81e95 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>   	}
>   
>   	if (!found) {
> +		ret = -1;
>   		err("Invalid port %s > maxports %d",
>   			port, vhci_driver->nports);
>   		goto call_driver_close;

With these changes:

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

thanks,
-- Shuah

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

* [PATCH v2] usbip: tools: Fix detach_port() invalid port error path
  2024-10-23 18:59 ` Shuah Khan
@ 2024-10-24  2:27   ` Zongmin Zhou
  2024-10-24 14:17     ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Zongmin Zhou @ 2024-10-24  2:27 UTC (permalink / raw)
  To: skhan
  Cc: i, linux-kernel, linux-usb, shuah, valentina.manea.m,
	Zongmin Zhou, stable

From: Zongmin Zhou <zhouzongmin@kylinos.cn>

The detach_port() doesn't return error
when detach is attempted on an invalid port.

Fixes: 40ecdeb1a187 ("usbip: usbip_detach: fix to check for invalid ports")
Cc: stable@vger.kernel.org
Reviewed-by: Hongren Zheng <i@zenithal.me>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
---
 tools/usb/usbip/src/usbip_detach.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index b29101986b5a..6b78d4a81e95 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -68,6 +68,7 @@ static int detach_port(char *port)
 	}
 
 	if (!found) {
+		ret = -1;
 		err("Invalid port %s > maxports %d",
 			port, vhci_driver->nports);
 		goto call_driver_close;
-- 
2.34.1


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

* Re: [PATCH v2] usbip: tools: Fix detach_port() invalid port error path
  2024-10-24  2:27   ` [PATCH v2] usbip: tools: Fix detach_port() invalid port error path Zongmin Zhou
@ 2024-10-24 14:17     ` Shuah Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2024-10-24 14:17 UTC (permalink / raw)
  To: Zongmin Zhou
  Cc: i, linux-kernel, linux-usb, shuah, valentina.manea.m,
	Zongmin Zhou, stable, Shuah Khan

On 10/23/24 20:27, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>
> 
> The detach_port() doesn't return error
> when detach is attempted on an invalid port.
> 
> Fixes: 40ecdeb1a187 ("usbip: usbip_detach: fix to check for invalid ports")
> Cc: stable@vger.kernel.org
> Reviewed-by: Hongren Zheng <i@zenithal.me>
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
> ---
>   tools/usb/usbip/src/usbip_detach.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
> index b29101986b5a..6b78d4a81e95 100644
> --- a/tools/usb/usbip/src/usbip_detach.c
> +++ b/tools/usb/usbip/src/usbip_detach.c
> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>   	}
>   
>   	if (!found) {
> +		ret = -1;
>   		err("Invalid port %s > maxports %d",
>   			port, vhci_driver->nports);
>   		goto call_driver_close;

Thank you.

Greg, Please pick this up.

thanks,
-- Shuah

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

* Re: [PATCH] usbip: tools: update return status when failed
  2024-10-22  7:58 ` Hongren Zheng
@ 2024-12-20 17:26   ` Shuah Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2024-12-20 17:26 UTC (permalink / raw)
  To: Hongren Zheng, Zongmin Zhou
  Cc: valentina.manea.m, shuah, linux-usb, linux-kernel, Zongmin Zhou,
	Shuah Khan

On 10/22/24 01:58, Hongren Zheng wrote:
> On Tue, Oct 22, 2024 at 02:48:56PM +0800, Zongmin Zhou wrote:
>> From: Zongmin Zhou <zhouzongmin@kylinos.cn>
>>
>> Have to set "ret" before return when found a invalid port.
>>
>> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
> 
> Reviewed-by: Hongren Zheng <i@zenithal.me>
> 
>> ---
>>   tools/usb/usbip/src/usbip_detach.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
>> index b29101986b5a..6b78d4a81e95 100644
>> --- a/tools/usb/usbip/src/usbip_detach.c
>> +++ b/tools/usb/usbip/src/usbip_detach.c
>> @@ -68,6 +68,7 @@ static int detach_port(char *port)
>>   	}
>>   
>>   	if (!found) {
>> +		ret = -1;
>>   		err("Invalid port %s > maxports %d",
>>   			port, vhci_driver->nports);
>>   		goto call_driver_close;
>> -- 
>> 2.34.1
>>

Looks like I missed this one. Sorry for the delay on this.

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

Greg, Please pick this one as well.

thanks,
-- Shuah

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

end of thread, other threads:[~2024-12-20 17:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22  6:48 [PATCH] usbip: tools: update return status when failed Zongmin Zhou
2024-10-22  7:58 ` Hongren Zheng
2024-12-20 17:26   ` Shuah Khan
2024-10-23 18:59 ` Shuah Khan
2024-10-24  2:27   ` [PATCH v2] usbip: tools: Fix detach_port() invalid port error path Zongmin Zhou
2024-10-24 14:17     ` 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).