]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: usbip: vhci: use urb->dev->portnum to find port
authorMax Vozeler <max@vozeler.com>
Wed, 12 Jan 2011 13:02:05 +0000 (15:02 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Mar 2011 23:05:10 +0000 (15:05 -0800)
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>
drivers/staging/usbip/vhci.h
drivers/staging/usbip/vhci_hcd.c

index 2cfd00ec1164256742ef28385d743a0288f8e35c..afc3b1a7188199bf29496fbb6e9933d6f3d37952 100644 (file)
@@ -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;
 };
 
 
index 22b1ad9ebd569405c4cec5f5d6beba86e678e35c..a35fe61268de3e974f8ece7f2edb0bd1e28b0468 100644 (file)
@@ -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);