]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
usbip: usbip_host: delete device from busid_table after rebind
authorShuah Khan (Samsung OSG) <shuah@kernel.org>
Mon, 30 Apr 2018 22:17:19 +0000 (16:17 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 May 2018 07:47:47 +0000 (09:47 +0200)
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>
drivers/usb/usbip/stub_main.c

index d41d0cdeec0f2a1861d8d42385a9719789cab558..fb46bd62d538302a205e15966e4fd72ac8a05b5d 100644 (file)
@@ -186,6 +186,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);
@@ -197,6 +200,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;
 }