Commit 9b6447e0 authored by Jose Ignacio Tornos Martinez's avatar Jose Ignacio Tornos Martinez Committed by Greg Kroah-Hartman

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: default avatarJose Ignacio Tornos Martinez <jtornosm@redhat.com>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20221003091016.641900-1-jtornosm@redhat.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61dd457c
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment