--- 8ed52063edb88cf4ba0a2b860989b371a25233df +++ 7636d86c23881589346167506f098e055aa4cafa @@ -21,14 +21,16 @@ #include "vhci.h" -/* get URB from transmitted urb queue. caller must hold vdev->priv_lock */ -struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, +/* get URB from transmitted urb queue */ +static struct urb *pickup_urb_and_free_priv(struct vhci_device *vdev, __u32 seqnum) { struct vhci_priv *priv, *tmp; struct urb *urb = NULL; int status; + spin_lock(&vdev->priv_lock); + list_for_each_entry_safe(priv, tmp, &vdev->priv_rx, list) { if (priv->seqnum == seqnum) { urb = priv->urb; @@ -59,6 +61,8 @@ struct urb *pickup_urb_and_free_priv(str } } + spin_unlock(&vdev->priv_lock); + return urb; } @@ -68,11 +72,9 @@ static void vhci_recv_ret_submit(struct struct usbip_device *ud = &vdev->ud; struct urb *urb; - spin_lock(&vdev->priv_lock); urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); - spin_unlock(&vdev->priv_lock); if (!urb) { usbip_uerr("cannot find a urb of seqnum %u\n", @@ -97,9 +99,6 @@ static void vhci_recv_ret_submit(struct if (usbip_recv_iso(ud, urb) < 0) return; - /* restore the padding in iso packets */ - if (usbip_pad_iso(ud, urb) < 0) - return; if (usbip_dbg_flag_vhci_rx) usbip_dump_urb(urb); @@ -160,12 +159,7 @@ static void vhci_recv_ret_unlink(struct return; } - spin_lock(&vdev->priv_lock); - urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); - - spin_unlock(&vdev->priv_lock); - if (!urb) { /* * I get the result of a unlink request. But, it seems that I