Hi Brett,
On 20.02.2011 05:55, Brett Wuth wrote:
> I have two identical USB to RS-232 dongles which I export from one
> machine to another using USB/IP. The devices appear correctly as
> /dev/ttyUSB0 and ttyUSB1 when attached one at time with a short delay
> between them (e.g. 60 seconds). When the attach commands are run
> immediately after each other only the second device attaches, and a
> kernel error appears.
[.. snip helpful details..]
These symptoms sound exactly like a bug that affected
the parallel attach of multiple devices which has been
fixed in Linux 2.6.38-rc2 and newer.
I have submitted the fix for the 2.6.32.y stable kernels
hoping to get it into a squeeze kernel update.
In the meantime until the fix gets into Debian you might
want to try applying the attached patch and rebuild the
modules and/or kernel packages.
Max
commit 01446ef5af4e8802369bf4d257806e24345a9371
Author: Max Vozeler <[email protected]>
Date: Wed Jan 12 15:02:05 2011 +0200
staging: usbip: vhci: use urb->dev->portnum to find port
The access to pending_port was racy when two devices
were being attached at the same time.
Signed-off-by: Max Vozeler <[email protected]>
Tested-by: Mark Wehby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h
index 2cfd00e..afc3b1a 100644
--- a/drivers/staging/usbip/vhci.h
+++ b/drivers/staging/usbip/vhci.h
@@ -100,9 +100,6 @@ struct vhci_hcd {
* But, the index of this array begins from 0.
*/
struct vhci_device vdev[VHCI_NPORTS];
-
- /* vhci_device which has not been assiged its address yet */
- int pending_port;
};
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index 22b1ad9..a35fe61 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -138,8 +138,6 @@ void rh_port_connect(int rhport, enum usb_device_speed speed)
* the_controller->vdev[rhport].ud.status = VDEV_CONNECT;
* spin_unlock(&the_controller->vdev[rhport].ud.lock); */
- the_controller->pending_port = rhport;
-
spin_unlock_irqrestore(&the_controller->lock, flags);
usb_hcd_poll_rh_status(vhci_to_hcd(the_controller));
@@ -575,7 +573,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
return urb->status;
}
- vdev = port_to_vdev(the_controller->pending_port);
+ vdev = port_to_vdev(urb->dev->portnum-1);
/* refuse enqueue for dead connection */
spin_lock(&vdev->ud.lock);