A request's complete() callback can enable IRQs (e.g. u_ether's rx_complete() calls netif_rx(), which re-enables IRQs when re-enabling BHs). If that happens while the endpoint's request queue is empty, the MUSB interrupt is handled with no request to take the packet, the interrupt flag is cleared but RXPKTRDY stays set, and the Rx endpoint locks up. Commit 3fc137386c46 ("usb: musb: Fix hardware lockup on first Rx endpoint request") listed several ways to fix this. Its second option was to keep MUSB interrupts from being handled while the callback runs. Implement that by masking the controller IRQ line around usb_gadget_giveback_request(), instead of flushing the Rx FIFO (which loses packets and was reverted). disable_irq_nosync() is used because musb_g_giveback() is usually called from the MUSB interrupt handler itself. Fixes: baebdf48c360 ("net: dev: Makes sure netif_rx() can be invoked in any context.") Cc: stable@vger.kernel.org Signed-off-by: Alexandru Ardelean --- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index dd67ab97df9d8..5cb7eb9c56de0 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -145,7 +145,10 @@ __acquires(ep->musb->lock) unmap_dma_buffer(req, musb); trace_musb_req_gb(req); + /* no MUSB interrupt during complete(), even if it enables IRQs */ + disable_irq_nosync(musb->nIrq); usb_gadget_giveback_request(&req->ep->end_point, &req->request); + enable_irq(musb->nIrq); spin_lock(&musb->lock); ep->busy = busy; } -- 2.43.0