Commit 342221f8 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by openeuler-sync-bot
Browse files

dmaengine: fsl-qdma: Fix a memory leak related to the queue command DMA

stable inclusion
from stable-v5.10.210
commit ae6769ba51417c1c86fb645812d5bff455eee802
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9Q99M
CVE: CVE-2024-35833

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ae6769ba51417c1c86fb645812d5bff455eee802



--------------------------------

[ Upstream commit 3aa58cb51318e329d203857f7a191678e60bb714 ]

This dma_alloc_coherent() is undone neither in the remove function, nor in
the error handling path of fsl_qdma_probe().

Switch to the managed version to fix both issues.

Fixes: b092529e ("dmaengine: fsl-qdma: Add qDMA controller driver for Layerscape SoCs")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/7f66aa14f59d32b13672dde28602b47deb294e1f.1704621515.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZe Zuo <zuoze1@huawei.com>
(cherry picked from commit 77cd6921)
parent 5d5e3280
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -514,7 +514,7 @@ static struct fsl_qdma_queue
			queue_temp = queue_head + i + (j * queue_num);

			queue_temp->cq =
			dma_alloc_coherent(&pdev->dev,
			dmam_alloc_coherent(&pdev->dev,
					    sizeof(struct fsl_qdma_format) *
					    queue_size[i],
					    &queue_temp->bus_addr,