summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorShuah Khan (Samsung OSG) <shuah@kernel.org>2018-04-30 16:17:19 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-03 13:52:02 -0700
commitae70c6dc3f956ce05cd06a61286b6d42189a2f6d (patch)
tree155d472617c4da7fbba6c6122105ab3b3b31d7f8 /drivers/usb
parent252427037a360dcf4ee4b38e3b11c85e884b6646 (diff)
downloadlinux-stable-ae70c6dc3f956ce05cd06a61286b6d42189a2f6d.tar.gz
linux-stable-ae70c6dc3f956ce05cd06a61286b6d42189a2f6d.tar.bz2
linux-stable-ae70c6dc3f956ce05cd06a61286b6d42189a2f6d.zip
usbip: usbip_host: delete device from busid_table after rebind
Device is left in the busid_table after unbind and rebind. Rebind initiates usb bus scan and the original driver claims the device. After rescan the device should be deleted from the busid_table as it no longer belongs to usbip_host. Fix it to delete the device after device_attach() succeeds. Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/usbip/stub_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index d41d0cdeec0f..fb46bd62d538 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -186,6 +186,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
if (!bid)
return -ENODEV;
+ /* mark the device for deletion so probe ignores it during rescan */
+ bid->status = STUB_BUSID_OTHER;
+
/* device_attach() callers should hold parent lock for USB */
if (bid->udev->dev.parent)
device_lock(bid->udev->dev.parent);
@@ -197,6 +200,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
return ret;
}
+ /* delete device from busid_table */
+ del_match_busid((char *) buf);
+
return count;
}