usbip: vhci_hcd: only return urb at enqueue when served
authorIgor Kotrasinski <i.kotrasinsk@samsung.com>
Mon, 21 Sep 2015 09:30:44 +0000 (11:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 09:59:03 +0000 (10:59 +0100)
We handle USB_REQ_SET_ADDRESS at enqueue, so we want to perform
cleanup and giveback the urb. We should not call usb_hcd_giveback_urb
when we're cleaning up after a failed enqueue, though.

Only giveback the urb at cleanup when we claim to have served it.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vhci_hcd.c

index 42c82317f15e856febe10126d8bc3aa37268c2da..51145cf92860d665ac6734c2996d61d727994d50 100644 (file)
@@ -565,7 +565,9 @@ no_need_xmit:
        usb_hcd_unlink_urb_from_ep(hcd, urb);
 no_need_unlink:
        spin_unlock(&the_controller->lock);
-       usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
+       if (!ret)
+               usb_hcd_giveback_urb(vhci_to_hcd(the_controller),
+                                    urb, urb->status);
        return ret;
 }