Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jose Ignacio Tornos Martinez and committed by
Greg Kroah-Hartman
9b6447e0 61dd457c

+2
+2
drivers/usb/usbip/stub_dev.c
··· 118 118 } else { 119 119 dev_info(dev, "stub down\n"); 120 120 121 + mutex_lock(&sdev->ud.sysfs_lock); 122 + 121 123 spin_lock_irq(&sdev->ud.lock); 122 124 if (sdev->ud.status != SDEV_ST_USED) 123 125 goto err;