Skip to content

Commit 6dcf12c

Browse files
Shuah Khan (Samsung OSG)ZhengShunQian
authored andcommitted
usbip: usbip_host: delete device from busid_table after rebind
commit 1e180f1 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) <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8754a75 commit 6dcf12c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/usb/usbip/stub_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
201201
if (!bid)
202202
return -ENODEV;
203203

204+
/* mark the device for deletion so probe ignores it during rescan */
205+
bid->status = STUB_BUSID_OTHER;
206+
204207
/* device_attach() callers should hold parent lock for USB */
205208
if (bid->udev->dev.parent)
206209
device_lock(bid->udev->dev.parent);
@@ -212,6 +215,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
212215
return ret;
213216
}
214217

218+
/* delete device from busid_table */
219+
del_match_busid((char *) buf);
220+
215221
return count;
216222
}
217223

0 commit comments

Comments
 (0)