usbip: usbip_host: run rebind from exit when module is removed
authorShuah Khan (Samsung OSG) <shuah@kernel.org>
Mon, 30 Apr 2018 22:17:20 +0000 (16:17 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 25 Sep 2018 22:47:22 +0000 (23:47 +0100)
commit9e45017ecab89b6dd4bd1d6bf05ce4d7b0e604fa
tree87adb203002e38f67a142a7fa3961d2c01b4f949
parent6a07695053815f39e331eb3689d52a7d0c27b0fe
usbip: usbip_host: run rebind from exit when module is removed

commit 7510df3f29d44685bab7b1918b61a8ccd57126a9 upstream.

After removing usbip_host module, devices it releases are left without
a driver. For example, when a keyboard or a mass storage device are
bound to usbip_host when it is removed, these devices are no longer
bound to any driver.

Fix it to run device_attach() from the module exit routine to restore
the devices to their original drivers. This includes cleanup changes
and moving device_attach() code to a common routine to be called from
rebind_store() and usbip_host_exit().

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust filenames]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/staging/usbip/stub_dev.c
drivers/staging/usbip/stub_main.c