Skip to contentSkip to conversation

usbip: vudc: fix missing unlock on error in usbip_sockfd_store()

PATCH Superseded Ye Bin 3 participants 5 messages Apr 8, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH 1/1 usbip: vudc: fix missing unlock on error in usbip_sockfd_store()

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

---
 drivers/usb/usbip/vudc_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/usbip/vudc_sysfs.c +2 -0
index f7633ee655a1..d1cf6b51bf85 100644
@@ -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;
 		}
 
#1 lore raw

这种bugfix最好加下Fixes tag

Quoted 31 lines · Ye Bin

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

---
 drivers/usb/usbip/vudc_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/usbip/vudc_sysfs.c +2 -0
index f7633ee655a1..d1cf6b51bf85 100644
@@ -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 lore raw
Quoted 2 lines · YueHaibing

这种bugfix最好加下Fixes tag

I am sorry but I can not parse that :(

#3 lore raw
Quoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · YueHaibing

这种bugfix最好加下Fixes tag

I am sorry but I can not parse that :(

Sorry, I just suggest to add this Fixes tag

Fixes bd8b82042269 ("usbip: vudc synchronize sysfs code paths")
Quoted 2 lines

.

#4 lore raw
Quoted 10 lines · YueHaibing
Quoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · YueHaibing

这种bugfix最好加下Fixes tag

I am sorry but I can not parse that :(

Sorry, I just suggest to add this Fixes tag

Fixes bd8b82042269 ("usbip: vudc synchronize sysfs code paths")

Yes, that would be great to have added, thanks!

greg k-h