DMA Engine development
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: Frank.Li@nxp.com
Cc: dmaengine@vger.kernel.org, imx@lists.linux.dev,
	linux-kernel@vger.kernel.org, vkoul@kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] dmaengine: fsl-edma: Fix channel leak in fsl_edma_xlate()
Date: Wed, 16 Sep 2026 09:27:33 +0000	[thread overview]
Message-ID: <20260916092733.2002700-1-vulab@iscas.ac.cn> (raw)

fsl_edma_xlate() grabs a channel with dma_get_slave_channel() before
validating the requested srcid. If the srcid turns out to be invalid,
the function just returns NULL, leaving the channel with its client
count elevated and marked private, so it can never be requested again.

Release the channel with dma_release_channel() before returning NULL.

Fixes: 6aa60f79e679 ("dmaengine: fsl-edma: add safety check for 'srcid'")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/dma/fsl-edma-main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index 36155ab1602a..11fbf6b1609b 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -279,6 +279,7 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec,
 				if (!fsl_chan->srcid) {
 					dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n",
 						fsl_chan->srcid);
+					dma_release_channel(chan);
 					return NULL;
 				}
 
-- 
2.34.1


             reply	other threads:[~2026-09-16  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  9:27 Wentao Liang [this message]
2026-09-16 16:01 ` [PATCH] dmaengine: fsl-edma: Fix channel leak in fsl_edma_xlate() Frank Li

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=20260916092733.2002700-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=Frank.Li@nxp.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /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