android_kernel_motorola_sm6375/drivers/dma
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Qiu-ji Chen 249bcc912e dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()
[ Upstream commit 157ae5ffd76a2857ccb4b7ce40bc5a344ca00395 ]

Fix a potential deadlock bug. Observe that in the mtk-cqdma.c
file, functions like mtk_cqdma_issue_pending() and
mtk_cqdma_free_active_desc() properly acquire the pc lock before the vc
lock when handling pc and vc fields. However, mtk_cqdma_tx_status()
violates this order by first acquiring the vc lock before invoking
mtk_cqdma_find_active_desc(), which subsequently takes the pc lock. This
reversed locking sequence (vc → pc) contradicts the established
pc → vc order and creates deadlock risks.

Fix the issue by moving the vc lock acquisition code from
mtk_cqdma_find_active_desc() to mtk_cqdma_tx_status(). Ensure the pc lock
is acquired before the vc lock in the calling function to maintain correct
locking hierarchy. Note that since mtk_cqdma_find_active_desc() is a
static function with only one caller (mtk_cqdma_tx_status()), this
modification safely eliminates the deadlock possibility without affecting
other components.

This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs to extract
function pairs that can be concurrently executed, and then analyzes the
instructions in the paired functions to identify possible concurrency bugs
including deadlocks, data races and atomicity violations.

Fixes: b1f01e48df ("dmaengine: mediatek: Add MediaTek Command-Queue DMA controller for MT6765 SoC")
Cc: stable@vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20250508073634.3719-1-chenqiuji666@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:44:00 +02:00
..
bestcomm
dw
dw-axi-dmac
dw-edma
hsu
ioat dmaengine: ioatdma: Fix missing kmem_cache_destroy() 2024-07-05 09:08:23 +02:00
ipu
mediatek dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status() 2025-09-09 18:44:00 +02:00
ppc4xx
qcom
sh dmaengine: shdma: increase size of 'dev_id' 2024-03-01 13:13:33 +01:00
ti dmaengine: ti: edma: fix OF node reference leaks in edma_driver 2025-03-13 12:42:59 +01:00
xilinx dmaengine: xilinx_dma: Set dma_device directions 2025-07-17 18:24:49 +02:00
acpi-dma.c
altera-msgdma.c
amba-pl08x.c
at_hdmac.c
at_hdmac_regs.h
at_xdmac.c dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset 2025-01-09 13:23:31 +01:00
bcm-sba-raid.c
bcm2835-dma.c
coh901318.c
coh901318.h
coh901318_lli.c
dma-axi-dmac.c dmaengine: axi-dmac: fix possible race in remove() 2024-07-05 09:08:19 +02:00
dma-jz4780.c
dmaengine.c
dmaengine.h
dmatest.c dmaengine: Revert "dmaengine: dmatest: Fix dmatest waiting less when interrupted" 2025-06-04 14:32:29 +02:00
ep93xx_dma.c
fsl-edma-common.c
fsl-edma-common.h
fsl-edma.c
fsl-qdma.c dmaengine: fsl-qdma: init irq after reg initialization 2024-03-06 14:36:09 +00:00
fsl_raid.c
fsl_raid.h
fsldma.c
fsldma.h
idma64.c dmaengine: idma64: Add check for dma_set_max_seg_size 2024-06-16 13:28:41 +02:00
idma64.h
img-mdc-dma.c
imx-dma.c
imx-sdma.c
iop-adma.c
iop-adma.h
k3dma.c
Kconfig dmaengine: tegra210-adma: Update dependency to ARCH_TEGRA 2024-03-26 18:22:19 -04:00
lpc18xx-dmamux.c
Makefile
mcf-edma.c
mic_x100_dma.c
mic_x100_dma.h
mmp_pdma.c
mmp_tdma.c
moxart-dma.c
mpc512x_dma.c
mv_xor.c dmaengine: mv_xor: Fix missing check after DMA map and missing unmap 2025-08-28 16:21:21 +02:00
mv_xor.h
mv_xor_v2.c
mxs-dma.c
nbpfaxi.c dmaengine: nbpfaxi: Add missing check after DMA map 2025-08-28 16:21:21 +02:00
of-dma.c
owl-dma.c dmaengine: owl: fix register access functions 2024-05-02 16:18:37 +02:00
pch_dma.c
pl330.c dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-05-17 11:43:46 +02:00
pxa_dma.c dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() 2023-11-20 10:30:14 +01:00
s3c24xx-dma.c
sa11x0-dma.c
sirf-dma.c
sprd-dma.c
st_fdma.c
st_fdma.h
ste_dma40.c dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe 2023-11-08 11:23:40 +01:00
ste_dma40_ll.c
ste_dma40_ll.h
stm32-dma.c
stm32-dmamux.c
stm32-mdma.c dmaengine: stm32-mdma: correct desc prep when channel running 2023-11-28 16:50:19 +00:00
sun4i-dma.c
sun6i-dma.c
tegra20-apb-dma.c
tegra210-adma.c
timb_dma.c
TODO
txx9dmac.c
txx9dmac.h
uniphier-mdmac.c
virt-dma.c
virt-dma.h
xgene-dma.c
zx_dma.c