diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2018-04-06 01:29:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-01 22:58:08 +0300 |
commit | 944edaf13deeb0db5847bddf956c4316e53d6f2c (patch) | |
tree | 48883d8625dd5882afbf09f9ddf1991f03b1ca0e /drivers/usb | |
parent | 470bf16ae1ab7172133fe3c6b4506a75f86d314f (diff) | |
download | linux-944edaf13deeb0db5847bddf956c4316e53d6f2c.tar.xz |
usbip: usbip_host: fix to hold parent lock for device_attach() calls
commit 4bfb141bc01312a817d36627cc47c93f801c216d upstream.
usbip_host calls device_attach() without holding dev->parent lock.
Fix it.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/usbip/stub_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c index 6968c906fa29..b59a253a8479 100644 --- a/drivers/usb/usbip/stub_main.c +++ b/drivers/usb/usbip/stub_main.c @@ -200,7 +200,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; |