summaryrefslogtreecommitdiff
path: root/drivers/usb/usbip
diff options
context:
space:
mode:
authorShuah Khan (Samsung OSG) <shuah@kernel.org>2018-05-01 01:17:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-05-22 19:53:55 +0300
commitcf3bcc3231ade09dd2733ca7d0f34d90ee7fe8fd (patch)
tree84ceacfa0cec35038203728dbc488daec8f66885 /drivers/usb/usbip
parenta3d5f6ecba9923a669a5991b8dbd3398c59bf892 (diff)
downloadlinux-cf3bcc3231ade09dd2733ca7d0f34d90ee7fe8fd.tar.xz
usbip: usbip_host: delete device from busid_table after rebind
commit 1e180f167d4e413afccbbb4a421b48b2de832549 upstream. 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> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/usbip')
-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 b59a253a8479..bfc8b32253ae 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -200,6 +200,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);
@@ -211,6 +214,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;
}