mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: omap1: Fix request_irq() leak
@ 2026-11-26 10:19 Thomas Fourier
  0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-11-26 10:19 UTC (permalink / raw)
  Cc: Thomas Fourier, Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren,
	Russell King, Kevin Hilman, G, Manjunath Kondaiah,
	open list:OMAP1 SUPPORT, moderated list:ARM SUB-ARCHITECTURES,
	open list

omap_system_dma_probe() requests one IRQ per channel with request_irq().
If an error occurs afterwards, probe returns without freeing the
requested IRQs. As dma_chan is allocated with devm_kcalloc, it is freed
if probe() fails. If one of the allocated IRQ is called, it dereferences
dma_chan causing a use after free.

Use devm_request_irq() to make cleanup automatic.

Fixes: f31cc9622d75 ("OMAP: DMA: Convert DMA library into platform driver")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 arch/arm/mach-omap1/omap-dma.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap1/omap-dma.c b/arch/arm/mach-omap1/omap-dma.c
index aebe5e55ff60..b0b46e7ec6b7 100644
--- a/arch/arm/mach-omap1/omap-dma.c
+++ b/arch/arm/mach-omap1/omap-dma.c
@@ -800,9 +800,9 @@ static int omap_system_dma_probe(struct platform_device *pdev)
 		if (dma_irq == INT_DMA_LCD)
 			continue;
 
-		ret = request_irq(dma_irq,
-				omap1_dma_irq_handler, 0, "DMA",
-				(void *) (ch + 1));
+		ret = devm_request_irq(&pdev->dev, dma_irq,
+				       omap1_dma_irq_handler, 0, "DMA",
+				       (void *) (ch + 1));
 		if (ret != 0)
 			goto exit_dma_irq_fail;
 	}
@@ -820,19 +820,8 @@ static int omap_system_dma_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static void omap_system_dma_remove(struct platform_device *pdev)
-{
-	int dma_irq, irq_rel = 0;
-
-	for ( ; irq_rel < dma_chan_count; irq_rel++) {
-		dma_irq = platform_get_irq(pdev, irq_rel);
-		free_irq(dma_irq, (void *)(irq_rel + 1));
-	}
-}
-
 static struct platform_driver omap_system_dma_driver = {
 	.probe		= omap_system_dma_probe,
-	.remove		= omap_system_dma_remove,
 	.driver		= {
 		.name	= "omap_dma_system"
 	},
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-26 10:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 10:19 [PATCH] ARM: omap1: Fix request_irq() leak Thomas Fourier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®