Skip to content

Commit

Permalink
USB: usbip: missing lock in stub down
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jose Ignacio Tornos Martinez authored and Greg Kroah-Hartman committed Oct 22, 2022
1 parent 61dd457 commit 9b6447e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9b6447e

Please sign in to comment.