Skip to content

Commit 1e180f1

Browse files
Shuah Khan (Samsung OSG)gregkh
authored andcommitted
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> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 28b68ac commit 1e180f1

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
@@ -186,6 +186,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
186186
if (!bid)
187187
return -ENODEV;
188188

189+
/* mark the device for deletion so probe ignores it during rescan */
190+
bid->status = STUB_BUSID_OTHER;
191+
189192
/* device_attach() callers should hold parent lock for USB */
190193
if (bid->udev->dev.parent)
191194
device_lock(bid->udev->dev.parent);
@@ -197,6 +200,9 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,
197200
return ret;
198201
}
199202

203+
/* delete device from busid_table */
204+
del_match_busid((char *) buf);
205+
200206
return count;
201207
}
202208

0 commit comments

Comments
 (0)