linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2/3] usbip: usbip_host: delete device from busid_table after rebind
@ 2018-04-22 13:57 Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2018-04-22 13:57 UTC (permalink / raw)
  To: Shuah Khan; +Cc: valentina.manea.m, shuah, linux-usb, linux-kernel

On Wed, Apr 11, 2018 at 06:13:31PM -0600, Shuah Khan wrote:
> 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 <shuahkh@osg.samsung.com>
> ---
>  drivers/usb/usbip/stub_main.c | 6 ++++++
>  1 file changed, 6 insertions(+)

This patch doesn't apply to my tree, nor does patch 3/3.  Can you rebase
and resend?

thanks,

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [2/3] usbip: usbip_host: delete device from busid_table after rebind
@ 2018-04-12  0:13 Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2018-04-12  0:13 UTC (permalink / raw)
  To: valentina.manea.m, shuah, gregkh; +Cc: Shuah Khan, linux-usb, linux-kernel

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 <shuahkh@osg.samsung.com>
---
 drivers/usb/usbip/stub_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index d41d0cdeec0f..fb46bd62d538 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -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;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-22 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-22 13:57 [2/3] usbip: usbip_host: delete device from busid_table after rebind Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2018-04-12  0:13 Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).