usb: xhci: trace URB before giving it back instead of after
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 17 May 2017 15:31:59 +0000 (18:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 13:19:41 +0000 (15:19 +0200)
Don't access any members of a URB after giving it back.
URB might be freed by then already.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c

index 74bf5c60a26075fff92cf74f6d3b2a2d4af4f0d4..507ba7734b94b90a11e96d2c32080ba155c1121a 100644 (file)
@@ -641,8 +641,8 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
        xhci_urb_free_priv(urb_priv);
        usb_hcd_unlink_urb_from_ep(hcd, urb);
        spin_unlock(&xhci->lock);
-       usb_hcd_giveback_urb(hcd, urb, status);
        trace_xhci_urb_giveback(urb);
+       usb_hcd_giveback_urb(hcd, urb, status);
        spin_lock(&xhci->lock);
 }