]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.133/usbip-usbip_host-delete-device-from-busid_table-after-rebind.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 4.4.133 / usbip-usbip_host-delete-device-from-busid_table-after-rebind.patch
CommitLineData
bdae2828
GKH
1From 1e180f167d4e413afccbbb4a421b48b2de832549 Mon Sep 17 00:00:00 2001
2From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>
3Date: Mon, 30 Apr 2018 16:17:19 -0600
4Subject: usbip: usbip_host: delete device from busid_table after rebind
5
6From: Shuah Khan (Samsung OSG) <shuah@kernel.org>
7
8commit 1e180f167d4e413afccbbb4a421b48b2de832549 upstream.
9
10Device is left in the busid_table after unbind and rebind. Rebind
11initiates usb bus scan and the original driver claims the device.
12After rescan the device should be deleted from the busid_table as
13it no longer belongs to usbip_host.
14
15Fix it to delete the device after device_attach() succeeds.
16
17Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
18Cc: stable <stable@vger.kernel.org>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 drivers/usb/usbip/stub_main.c | 6 ++++++
23 1 file changed, 6 insertions(+)
24
25--- a/drivers/usb/usbip/stub_main.c
26+++ b/drivers/usb/usbip/stub_main.c
27@@ -201,6 +201,9 @@ static ssize_t rebind_store(struct devic
28 if (!bid)
29 return -ENODEV;
30
31+ /* mark the device for deletion so probe ignores it during rescan */
32+ bid->status = STUB_BUSID_OTHER;
33+
34 /* device_attach() callers should hold parent lock for USB */
35 if (bid->udev->dev.parent)
36 device_lock(bid->udev->dev.parent);
37@@ -212,6 +215,9 @@ static ssize_t rebind_store(struct devic
38 return ret;
39 }
40
41+ /* delete device from busid_table */
42+ del_match_busid((char *) buf);
43+
44 return count;
45 }
46