Re: [PATCH -next v2] usbip: vudc: fix missing unlock on error in usbip_sockfd_store()

From
yebin <hidden>
Date
2021-04-12 07:00:19
Also in
kernel-janitors
Reply to
Greg KH, 2021-04-09
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:
quoted
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 <redacted>
Signed-off-by: Ye Bin <redacted>
---
  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???

.
  
Thread (5 messages) 5 messages, 3 authors, last reply 2021-04-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help