diff options
author | Duoming Zhou | 2023-08-06 11:25:11 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-10-19 23:08:58 +0200 |
commit | 9a995e11b23f4afb4fe50e7d4d420e3ddcaa35a1 (patch) | |
tree | 7628fef2858409df0873047cd43dfaeba61a06bf /net/8021q | |
parent | 01b19fc6621d2b10d2433b1f0259f5745e403cd9 (diff) |
dmaengine: mediatek: Fix deadlock caused by synchronize_irq()
[ Upstream commit 01f1ae2733e2bb4de92fefcea5fda847d92aede1 ]
The synchronize_irq(c->irq) will not return until the IRQ handler
mtk_uart_apdma_irq_handler() is completed. If the synchronize_irq()
holds a spin_lock and waits the IRQ handler to complete, but the
IRQ handler also needs the same spin_lock. The deadlock will happen.
The process is shown below:
cpu0 cpu1
mtk_uart_apdma_device_pause() | mtk_uart_apdma_irq_handler()
spin_lock_irqsave() |
| spin_lock_irqsave()
//hold the lock to wait |
synchronize_irq() |
This patch reorders the synchronize_irq(c->irq) outside the spin_lock
in order to mitigate the bug.
Fixes: 9135408c3ace ("dmaengine: mediatek: Add MediaTek UART APDMA support")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com>
Link: https://lore.kernel.org/r/20230806032511.45263-1-duoming@zju.edu.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/8021q')
0 files changed, 0 insertions, 0 deletions