Two usbfs users can claim the same interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If process A has an interface claimed and process B disconnects the
kernel driver then process B can also claim the interface.

I think USBFSDEV_DISCONNECT shouldn't disconnect the usbfs driver.
Something like this (untested) patch.  Is this the correct approach or
should userspace processes be more co-operative?  e.g., by making
libusb's libusb_kernel_driver_active() returning false if driver ==
"usbfs" and expecting users to only call libusb_detach_kernel_driver()
if one is active.

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1552,7 +1552,8 @@ static int proc_ioctl(struct dev_state *ps, struct
usbdevfs_ioctl *ctl)

 	/* disconnect kernel driver from interface */
 	case USBDEVFS_DISCONNECT:
-		if (intf->dev.driver) {
+		if (intf->dev.driver
+		    && intf->dev.driver != &usbfs_driver.drvwrap.driver) {
 			driver = to_usb_driver(intf->dev.driver);
 			dev_dbg(&intf->dev, "disconnect by usbfs\n");
 			usb_driver_release_interface(driver, intf);

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux