]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
authorYe Bin <yebin10@huawei.com>
Thu, 8 Apr 2021 11:23:05 +0000 (19:23 +0800)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:26 +0000 (17:46 -0600)
BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit 1d08ed588c6a85a35a24c82eb4cf0807ec2b366a ]

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>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20210408112305.1022247-1-yebin10@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/usb/usbip/vudc_sysfs.c

index f7633ee655a17bed82b5baf9cffefc69b6ffd7f0..d1cf6b51bf85dc7cc6e2ed6105cc5300f67ce9ca 100644 (file)
@@ -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;
                }