2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 10:13:57 +08:00

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 <jtornosm@redhat.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/20221003091016.641900-1-jtornosm@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jose Ignacio Tornos Martinez 2022-10-03 11:10:16 +02:00 committed by Greg Kroah-Hartman
parent 61dd457c01
commit 9b6447e04b

View File

@ -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;