Skip to contentSkip to conversation

patch "usbip: usbip_host: fix to hold parent lock for device_attach() calls" added to usb-linus

PATCH [email protected] 1 participant 1 message Apr 22, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usbip: usbip_host: fix to hold parent lock for device_attach() calls

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 4bfb141bc01312a817d36627cc47c93f801c216d Mon Sep 17 00:00:00 2001

From: Shuah Khan <[email protected]>
Date: Thu, 5 Apr 2018 16:29:04 -0600
Subject: usbip: usbip_host: fix to hold parent lock for device_attach() calls

usbip_host calls device_attach() without holding dev->parent lock. Fix it.

---
 drivers/usb/usbip/stub_main.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/usbip/stub_main.c +5 -0
index c31c8402a0c5..d41d0cdeec0f 100644
@@ -186,7 +186,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
 	if (!bid)
 		return -ENODEV;
 
+	/* device_attach() callers should hold parent lock for USB */
+	if (bid->udev->dev.parent)
+		device_lock(bid->udev->dev.parent);
 	ret = device_attach(&bid->udev->dev);
+	if (bid->udev->dev.parent)
+		device_unlock(bid->udev->dev.parent);
 	if (ret < 0) {
 		dev_err(&bid->udev->dev, "rebind failed\n");
 		return ret;
Signature · 1 line
2.17.0