linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
@ 2021-04-08 11:23 Ye Bin
  2021-04-08 15:14 ` Shuah Khan
  2021-04-09 14:04 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Ye Bin @ 2021-04-08 11:23 UTC (permalink / raw)
  To: valentina.manea.m, shuah, gregkh, yebin10
  Cc: linux-usb, kernel-janitors, hulkci

Add the missing unlock before return from function usbip_sockfd_store()
in the error handling case.

Fixes: bd8b82042269 ("usbip: vudc synchronize sysfs code paths")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/usb/usbip/vudc_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
index f7633ee655a1..d1cf6b51bf85 100644
--- a/drivers/usb/usbip/vudc_sysfs.c
+++ b/drivers/usb/usbip/vudc_sysfs.c
@@ -156,12 +156,14 @@ static ssize_t usbip_sockfd_store(struct device *dev,
 		tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
 		if (IS_ERR(tcp_rx)) {
 			sockfd_put(socket);
+			mutex_unlock(&udc->ud.sysfs_lock);
 			return -EINVAL;
 		}
 		tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
 		if (IS_ERR(tcp_tx)) {
 			kthread_stop(tcp_rx);
 			sockfd_put(socket);
+			mutex_unlock(&udc->ud.sysfs_lock);
 			return -EINVAL;
 		}
 
-- 
2.25.4


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

* Re: [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
  2021-04-08 11:23 [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store() Ye Bin
@ 2021-04-08 15:14 ` Shuah Khan
  2021-04-09 14:04 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2021-04-08 15:14 UTC (permalink / raw)
  To: Ye Bin, valentina.manea.m, shuah, gregkh
  Cc: linux-usb, kernel-janitors, hulkci, Shuah Khan

On 4/8/21 5:23 AM, Ye Bin wrote:
> Add the missing unlock before return from function usbip_sockfd_store()
> in the error handling case.
> 
> Fixes: bd8b82042269 ("usbip: vudc synchronize sysfs code paths")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>   drivers/usb/usbip/vudc_sysfs.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
> index f7633ee655a1..d1cf6b51bf85 100644
> --- a/drivers/usb/usbip/vudc_sysfs.c
> +++ b/drivers/usb/usbip/vudc_sysfs.c
> @@ -156,12 +156,14 @@ static ssize_t usbip_sockfd_store(struct device *dev,
>   		tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
>   		if (IS_ERR(tcp_rx)) {
>   			sockfd_put(socket);
> +			mutex_unlock(&udc->ud.sysfs_lock);
>   			return -EINVAL;
>   		}
>   		tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
>   		if (IS_ERR(tcp_tx)) {
>   			kthread_stop(tcp_rx);
>   			sockfd_put(socket);
> +			mutex_unlock(&udc->ud.sysfs_lock);
>   			return -EINVAL;
>   		}
>   
> 

Thank you for finding and fixing this.

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

thanks,
-- Shuah

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

* Re: [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
  2021-04-08 11:23 [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store() Ye Bin
  2021-04-08 15:14 ` Shuah Khan
@ 2021-04-09 14:04 ` Greg KH
  2021-04-12  7:00   ` yebin
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2021-04-09 14:04 UTC (permalink / raw)
  To: Ye Bin; +Cc: valentina.manea.m, shuah, linux-usb, kernel-janitors, hulkci

On Thu, Apr 08, 2021 at 07:23:05PM +0800, Ye Bin wrote:
> Add the missing unlock before return from function usbip_sockfd_store()
> in the error handling case.
> 
> Fixes: bd8b82042269 ("usbip: vudc synchronize sysfs code paths")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
>  drivers/usb/usbip/vudc_sysfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
> index f7633ee655a1..d1cf6b51bf85 100644
> --- a/drivers/usb/usbip/vudc_sysfs.c
> +++ b/drivers/usb/usbip/vudc_sysfs.c
> @@ -156,12 +156,14 @@ static ssize_t usbip_sockfd_store(struct device *dev,
>  		tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
>  		if (IS_ERR(tcp_rx)) {
>  			sockfd_put(socket);
> +			mutex_unlock(&udc->ud.sysfs_lock);
>  			return -EINVAL;
>  		}
>  		tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
>  		if (IS_ERR(tcp_tx)) {
>  			kthread_stop(tcp_rx);
>  			sockfd_put(socket);
> +			mutex_unlock(&udc->ud.sysfs_lock);
>  			return -EINVAL;
>  		}
>  
> -- 
> 2.25.4
> 

This breaks the build, are you sure you tested it???


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

* Re: [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
  2021-04-09 14:04 ` Greg KH
@ 2021-04-12  7:00   ` yebin
  2021-04-12  8:30     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: yebin @ 2021-04-12  7:00 UTC (permalink / raw)
  To: Greg KH; +Cc: valentina.manea.m, shuah, linux-usb, kernel-janitors, hulkci

Sorry. I build kernel  image  with  follow config and  commit  base on 
linux-next:
commit:e99d8a849517
config:  make allmodconfig
I can build kernel image without errors. So, what build error did you 
encounter?

On 2021/4/9 22:04, Greg KH wrote:
> On Thu, Apr 08, 2021 at 07:23:05PM +0800, Ye Bin wrote:
>> Add the missing unlock before return from function usbip_sockfd_store()
>> in the error handling case.
>>
>> Fixes: bd8b82042269 ("usbip: vudc synchronize sysfs code paths")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Ye Bin <yebin10@huawei.com>
>> ---
>>   drivers/usb/usbip/vudc_sysfs.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
>> index f7633ee655a1..d1cf6b51bf85 100644
>> --- a/drivers/usb/usbip/vudc_sysfs.c
>> +++ b/drivers/usb/usbip/vudc_sysfs.c
>> @@ -156,12 +156,14 @@ static ssize_t usbip_sockfd_store(struct device *dev,
>>   		tcp_rx = kthread_create(&v_rx_loop, &udc->ud, "vudc_rx");
>>   		if (IS_ERR(tcp_rx)) {
>>   			sockfd_put(socket);
>> +			mutex_unlock(&udc->ud.sysfs_lock);
>>   			return -EINVAL;
>>   		}
>>   		tcp_tx = kthread_create(&v_tx_loop, &udc->ud, "vudc_tx");
>>   		if (IS_ERR(tcp_tx)) {
>>   			kthread_stop(tcp_rx);
>>   			sockfd_put(socket);
>> +			mutex_unlock(&udc->ud.sysfs_lock);
>>   			return -EINVAL;
>>   		}
>>   
>> -- 
>> 2.25.4
>>
> This breaks the build, are you sure you tested it???
>
> .
>


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

* Re: [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
  2021-04-12  7:00   ` yebin
@ 2021-04-12  8:30     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2021-04-12  8:30 UTC (permalink / raw)
  To: yebin; +Cc: valentina.manea.m, shuah, linux-usb, kernel-janitors, hulkci

On Mon, Apr 12, 2021 at 03:00:03PM +0800, yebin wrote:
> Sorry. I build kernel  image  with  follow config and  commit  base on
> linux-next:
> commit:e99d8a849517
> config:  make allmodconfig
> I can build kernel image without errors. So, what build error did you
> encounter?

Ah, I missed that this was only in my usb-linus branch, which is now in
Linus's tree, so I can take this, sorry for the noise...

greg k-h

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

end of thread, other threads:[~2021-04-12  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 11:23 [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store() Ye Bin
2021-04-08 15:14 ` Shuah Khan
2021-04-09 14:04 ` Greg KH
2021-04-12  7:00   ` yebin
2021-04-12  8:30     ` Greg KH

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