From: Jose Ignacio Tornos Martinez Date: Mon, 3 Oct 2022 09:10:16 +0000 (+0200) Subject: USB: usbip: missing lock in stub down X-Git-Tag: v6.2-rc1~70^2~142 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=9b6447e04bc2a4d06f2ef74a583848c573a25dbc;p=linux-block.git 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 Reviewed-by: Shuah Khan Link: https://lore.kernel.org/r/20221003091016.641900-1-jtornosm@redhat.com Signed-off-by: Greg Kroah-Hartman --- 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;