diff options
author | Max Vozeler <max@vozeler.com> | 2011-01-12 15:02:05 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-02 09:47:04 -0500 |
commit | e9053787c8757b2c210d3db2f866bc8036ae205f (patch) | |
tree | 22ac2a58ff9e2bf75c17a6800db9e848bbf6a3e0 | |
parent | e28b4a0b20c3ca4b45cc3030906a09fd502a173d (diff) |
staging: usbip: vhci: use urb->dev->portnum to find port
commit 01446ef5af4e8802369bf4d257806e24345a9371 upstream.
The access to pending_port was racy when two devices
were being attached at the same time.
Signed-off-by: Max Vozeler <max@vozeler.com>
Tested-by: Mark Wehby <MWehby@luxotticaRetail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/usbip/vhci.h | 3 | ||||
-rw-r--r-- | drivers/staging/usbip/vhci_hcd.c | 4 |
2 files changed, 1 insertions, 6 deletions
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h index ad3a19dac54..57f79463de9 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 235ad04924f..1c173195c51 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -137,8 +137,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)); @@ -574,7 +572,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); |