From: Shuah Khan Date: Tue, 6 Oct 2020 22:39:14 +0000 (-0600) Subject: usbip: vhci_hcd: fix calling usb_hcd_giveback_urb() with irqs enabled X-Git-Tag: v5.10.7~1419^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e8586827a7061fdb183e6571fac63af378be013;p=platform%2Fkernel%2Flinux-rpi.git 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 Suggested-by: Alan Stern Acked-by: Andrey Konovalov Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20201006223914.39257-1-skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 1b598db5d8b9..66cde5e5f796 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -797,8 +797,14 @@ no_need_xmit: usb_hcd_unlink_urb_from_ep(hcd, urb); no_need_unlink: spin_unlock_irqrestore(&vhci->lock, flags); - if (!ret) + if (!ret) { + /* usb_hcd_giveback_urb() should be called with + * irqs disabled + */ + local_irq_disable(); usb_hcd_giveback_urb(hcd, urb, urb->status); + local_irq_enable(); + } return ret; }