Skip to content

Commit 9e85868

Browse files
shuahkhgregkh
authored andcommitted
usbip: vhci_hcd: fix calling usb_hcd_giveback_urb() with irqs enabled
kcov testing uncovered call to usb_hcd_giveback_urb() without disabling interrupts. Link: https://lore.kernel.org/linux-usb/CAAeHK+wb4k-LGTjK9F5YbJNviF_+yU+wE_=Vpo9Rn7KFN8vG6Q@mail.gmail.com/ usb_hcd_giveback_urb() is called from vhci's urb_enqueue, when it determines it doesn't need to xmit the urb and can give it back. This path runs in task context. Disable irqs around usb_hcd_giveback_urb() call. Reported-by: Andrey Konovalov <[email protected]> Suggested-by: Alan Stern <[email protected]> Acked-by: Andrey Konovalov <[email protected]> Signed-off-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a4f8843 commit 9e85868

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/usb/usbip/vhci_hcd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,14 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
797797
usb_hcd_unlink_urb_from_ep(hcd, urb);
798798
no_need_unlink:
799799
spin_unlock_irqrestore(&vhci->lock, flags);
800-
if (!ret)
800+
if (!ret) {
801+
/* usb_hcd_giveback_urb() should be called with
802+
* irqs disabled
803+
*/
804+
local_irq_disable();
801805
usb_hcd_giveback_urb(hcd, urb, urb->status);
806+
local_irq_enable();
807+
}
802808
return ret;
803809
}
804810

0 commit comments

Comments
 (0)