Thread (3 messages) flat view 3 messages, 3 authors, 2025-06-09
STALE427d

[PATCH] (powerpc/512) Fix possible `dma_unmap_single()` on uninitialized pointer

From: Thomas Fourier <hidden>
Date: 2025-06-05 16:39:39
Also in: lkml
Subsystem: linux for powerpc (32-bit and 64-bit), linux for powerpc embedded mpc5xxx, the rest · Maintainers: Madhavan Srinivasan, Anatolij Gustschin, Linus Torvalds

If the device configuration fails (if `dma_dev->device_config()`),
`sg_dma_address(&sg)` is not initialized and the jump to `err_dma_prep`
leads to calling `dma_unmap_single()` on `sg_dma_address(&sg)`.

Signed-off-by: Thomas Fourier <redacted>
---
 arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
index 9668b052cd4b..ef3be438f914 100644
--- a/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
+++ b/arch/powerpc/platforms/512x/mpc512x_lpbfifo.c
@@ -241,8 +241,7 @@ static int mpc512x_lpbfifo_kick(void)
 
 	/* Make DMA channel work with LPB FIFO data register */
 	if (dma_dev->device_config(lpbfifo.chan, &dma_conf)) {
-		ret = -EINVAL;
-		goto err_dma_prep;
+		return -EINVAL;
 	}
 
 	sg_init_table(&sg, 1);
-- 
2.43.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help