Commit d584d775 authored by Shuah Khan's avatar Shuah Khan Committed by Stefan Bader

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

BugLink: http://bugs.launchpad.net/bugs/1768825

commit 4bfb141b upstream.

usbip_host calls device_attach() without holding dev->parent lock.
Fix it.
Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 50a76dca
...@@ -201,7 +201,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf, ...@@ -201,7 +201,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
if (!bid) if (!bid)
return -ENODEV; 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); ret = device_attach(&bid->udev->dev);
if (bid->udev->dev.parent)
device_unlock(bid->udev->dev.parent);
if (ret < 0) { if (ret < 0) {
dev_err(&bid->udev->dev, "rebind failed\n"); dev_err(&bid->udev->dev, "rebind failed\n");
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment