aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ignacio Tornos Martinez <[email protected]>2022-10-03 11:10:16 +0200
committerGreg Kroah-Hartman <[email protected]>2022-10-22 13:22:25 +0200
commit9b6447e04bc2a4d06f2ef74a583848c573a25dbc (patch)
treef2236497a7aec10596acb58896446681693aac3f
parent61dd457c0188c0deef68c2b919c0a2defe5db388 (diff)
USB: usbip: missing lock in stub down
Missing lock in sysfs operation when we want to close the connection in order to check the status and send the down event in a safe way. Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]> Reviewed-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/usbip/stub_dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
index f92047d860f0..9c6954aad6c8 100644
--- a/drivers/usb/usbip/stub_dev.c
+++ b/drivers/usb/usbip/stub_dev.c
@@ -118,6 +118,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
} else {
dev_info(dev, "stub down\n");
+ mutex_lock(&sdev->ud.sysfs_lock);
+
spin_lock_irq(&sdev->ud.lock);
if (sdev->ud.status != SDEV_ST_USED)
goto err;