mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Russell King <linux@armlinux.org.uk>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	"G, Manjunath Kondaiah" <manjugk@ti.com>,
	linux-omap@vger.kernel.org (open list:OMAP1 SUPPORT),
	linux-arm-kernel@lists.infradead.org (moderated list:ARM
	SUB-ARCHITECTURES), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ARM: omap1: Fix request_irq() leak
Date: Thu, 26 Nov 2026 11:19:44 +0100	[thread overview]
Message-ID: <20261126101947.28547-2-fourier.thomas@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-26 10:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126101947.28547-2-fourier.thomas@gmail.com \
    --to=fourier.thomas@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=jmkrzyszt@gmail.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=manjugk@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®