--- x/drivers/usb/usbip/vhci_hcd.c +++ y/drivers/usb/usbip/vhci_hcd.c @@ -911,11 +911,6 @@ static int vhci_urb_dequeue(struct usb_h * Otherwise, we give back it here. */ usb_hcd_unlink_urb_from_ep(hcd, urb); - - spin_unlock_irqrestore(&vhci->lock, flags); - usb_hcd_giveback_urb(hcd, urb, urb->status); - spin_lock_irqsave(&vhci->lock, flags); - } else { /* tcp connection is alive */ struct vhci_unlink *unlink; @@ -927,6 +922,7 @@ static int vhci_urb_dequeue(struct usb_h if (!unlink) { spin_unlock(&vdev->priv_lock); spin_unlock_irqrestore(&vhci->lock, flags); + usb_hcd_giveback_urb(hcd, urb, urb->status); usbip_event_add(&vdev->ud, VDEV_EVENT_ERROR_MALLOC); return -ENOMEM; } @@ -947,6 +943,7 @@ static int vhci_urb_dequeue(struct usb_h spin_unlock_irqrestore(&vhci->lock, flags); + usb_hcd_giveback_urb(hcd, urb, urb->status); usbip_dbg_vhci_hc("leave\n"); return 0; }