Skip to content

Commit 4bfb141

Browse files
Shuah Khangregkh
authored andcommitted
usbip: usbip_host: fix to hold parent lock for device_attach() calls
usbip_host calls device_attach() without holding dev->parent lock. Fix it. Signed-off-by: Shuah Khan <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9020a7e commit 4bfb141

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/usbip/stub_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
186186
if (!bid)
187187
return -ENODEV;
188188

189+
/* device_attach() callers should hold parent lock for USB */
190+
if (bid->udev->dev.parent)
191+
device_lock(bid->udev->dev.parent);
189192
ret = device_attach(&bid->udev->dev);
193+
if (bid->udev->dev.parent)
194+
device_unlock(bid->udev->dev.parent);
190195
if (ret < 0) {
191196
dev_err(&bid->udev->dev, "rebind failed\n");
192197
return ret;

0 commit comments

Comments
 (0)