]>
Commit | Line | Data |
---|---|---|
bdae2828 GKH |
1 | From 1e180f167d4e413afccbbb4a421b48b2de832549 Mon Sep 17 00:00:00 2001 |
2 | From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org> | |
3 | Date: Mon, 30 Apr 2018 16:17:19 -0600 | |
4 | Subject: usbip: usbip_host: delete device from busid_table after rebind | |
5 | ||
6 | From: Shuah Khan (Samsung OSG) <shuah@kernel.org> | |
7 | ||
8 | commit 1e180f167d4e413afccbbb4a421b48b2de832549 upstream. | |
9 | ||
10 | Device is left in the busid_table after unbind and rebind. Rebind | |
11 | initiates usb bus scan and the original driver claims the device. | |
12 | After rescan the device should be deleted from the busid_table as | |
13 | it no longer belongs to usbip_host. | |
14 | ||
15 | Fix it to delete the device after device_attach() succeeds. | |
16 | ||
17 | Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org> | |
18 | Cc: stable <stable@vger.kernel.org> | |
19 | Signed-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 |