mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
usb: cdns3: Fix deadlock when using NCM gadget
commit a1059896f2bfdcebcdc7153c3be2307ea319501f upstream.
The cdns3 driver has the same NCM deadlock as fixed in cdnsp by commit
58f2fcb3a845 ("usb: cdnsp: Fix deadlock issue during using NCM gadget").
Under PREEMPT_RT the deadlock can be readily triggered by heavy network
traffic, for example using "iperf --bidir" over NCM ethernet link.
The deadlock occurs because the threaded interrupt handler gets
preempted by a softirq, but both are protected by the same spinlock.
Prevent deadlock by disabling softirq during threaded irq handler.
Cc: stable <stable@kernel.org>
Fixes: 7733f6c32e ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Acked-by: Peter Chen <peter.chen@kernel.org>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20250318-rfs-cdns3-deadlock-v2-1-bfd9cfcee732@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0a8f200a1a
commit
c27db84ed4
@@ -1960,6 +1960,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
|
|||||||
unsigned int bit;
|
unsigned int bit;
|
||||||
unsigned long reg;
|
unsigned long reg;
|
||||||
|
|
||||||
|
local_bh_disable();
|
||||||
spin_lock_irqsave(&priv_dev->lock, flags);
|
spin_lock_irqsave(&priv_dev->lock, flags);
|
||||||
|
|
||||||
reg = readl(&priv_dev->regs->usb_ists);
|
reg = readl(&priv_dev->regs->usb_ists);
|
||||||
@@ -2001,6 +2002,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)
|
|||||||
irqend:
|
irqend:
|
||||||
writel(~0, &priv_dev->regs->ep_ien);
|
writel(~0, &priv_dev->regs->ep_ien);
|
||||||
spin_unlock_irqrestore(&priv_dev->lock, flags);
|
spin_unlock_irqrestore(&priv_dev->lock, flags);
|
||||||
|
local_bh_enable();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user