Skip to content

usbip synchronize sysfs code paths

Shuah Khan linux-usb lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4usbip: add sysfs_lock to synchronize sysfs code pathsdrivers/usb/usbip/usbip_common.h drivers/usb/usbip/vhci_hcd.c drivers/usb/usbip/vhci_sysfs.c+29 -50 replies
2/4usbip: stub-dev synchronize sysfs code pathsdrivers/usb/usbip/stub_dev.c+9 -20 replies
3/4usbip: vudc synchronize sysfs code pathsdrivers/usb/usbip/vudc_dev.c drivers/usb/usbip/vudc_sysfs.c+6 -00 replies
4/4usbip: synchronize event handler with sysfs code pathsdrivers/usb/usbip/usbip_event.c+2 -00 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

Patch[email protected]
1/4Reported-and-tested-by
2/4Reported-and-tested-by
3/4Reported-and-tested-by
4/4Reported-and-tested-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] usbip 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.

This problem is common to all drivers while it can be reproduced easily in vhci_hcd. Add a sysfs_lock to usbip_device struct to protect the paths.

For a complete fix, all usbip drivers have to use sysfs_lock to protect sysfs code paths and common event handler will have to use this lock to synchonize with the sysfs paths in drivers.

This patch series adds sysfs_lock and uses it in vhci_hcd in the first patch. Subsequent patches fix usbip_host, vudc and the last patch fixes the common event handler code path.

Shuah Khan (4):
usbip: add sysfs_lock to synchronize sysfs code paths
usbip: stub-dev synchronize sysfs code paths
usbip: vudc synchronize sysfs code paths
usbip: synchronize event handler with sysfs code paths

 drivers/usb/usbip/stub_dev.c     | 11 +++++++++--
 drivers/usb/usbip/usbip_common.h |  3 +++
 drivers/usb/usbip/usbip_event.c  |  2 ++
 drivers/usb/usbip/vhci_hcd.c     |  1 +
 drivers/usb/usbip/vhci_sysfs.c   | 30 +++++++++++++++++++++++++-----
 drivers/usb/usbip/vudc_dev.c     |  1 +
 drivers/usb/usbip/vudc_sysfs.c   |  5 +++++
 7 files changed, 46 insertions(+), 7 deletions(-)
Signature · 1 line
2.27.0