usbip: stub-dev synchronize sysfs code paths
authorShuah Khan <skhan@linuxfoundation.org>
Tue, 30 Mar 2021 01:36:49 +0000 (19:36 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Apr 2021 07:05:42 +0000 (09:05 +0200)
commit9dbf34a834563dada91366c2ac266f32ff34641a
tree7ae2ddc43c3bde1d31dde23e61cf1aaa9884a79a
parent4e9c93af7279b059faf5bb1897ee90512b258a12
usbip: stub-dev synchronize sysfs code paths

Fuzzing uncovered race condition between sysfs code paths in usbip
drivers. Device connect/disconnect code paths initiated through
sysfs interface are prone to races if disconnect happens during
connect and vice versa.

Use sysfs_lock to protect sysfs paths in stub-dev.

Cc: stable@vger.kernel.org
Reported-and-tested-by: syzbot+a93fba6d384346a761e3@syzkaller.appspotmail.com
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lore.kernel.org/r/2b182f3561b4a065bf3bf6dce3b0e9944ba17b3f.1616807117.git.skhan@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/stub_dev.c