Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <shuahkh@osg.samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Shuah Khan and committed by
Greg Kroah-Hartman
4bfb141b 9020a7ef

+5
+5
drivers/usb/usbip/stub_main.c
··· 186 186 if (!bid) 187 187 return -ENODEV; 188 188 189 + /* device_attach() callers should hold parent lock for USB */ 190 + if (bid->udev->dev.parent) 191 + device_lock(bid->udev->dev.parent); 189 192 ret = device_attach(&bid->udev->dev); 193 + if (bid->udev->dev.parent) 194 + device_unlock(bid->udev->dev.parent); 190 195 if (ret < 0) { 191 196 dev_err(&bid->udev->dev, "rebind failed\n"); 192 197 return ret;