From: Frank Li <Frank.li@oss.nxp.com>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: Frank.Li@nxp.com, dmaengine@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, vkoul@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] dmaengine: fsl-edma: Fix channel leak in fsl_edma_xlate()
Date: Wed, 16 Sep 2026 11:01:48 -0500 [thread overview]
Message-ID: <aqq9bJIFvzb74ku7@SMW015318> (raw)
In-Reply-To: <20260916092733.2002700-1-vulab@iscas.ac.cn>
On Wed, Sep 16, 2026 at 09:27:33AM +0000, Wentao Liang wrote:
> 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);
fsl_chan->srcid = dma_spec->args[1];
check dma_spec->args[1] before dma_get_slave_channel(chan)
combine into
if (!dma_spec->args[1] || fsl_edma_srcid_in_use(fsl_edma, dma_spec->args[1]))
return NULL;
Frank
> return NULL;
> }
>
> --
> 2.34.1
>
>
prev parent reply other threads:[~2026-09-16 16:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 9:27 Wentao Liang
2026-09-16 16:01 ` Frank Li [this message]
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=aqq9bJIFvzb74ku7@SMW015318 \
--to=frank.li@oss.nxp.com \
--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 \
--cc=vulab@iscas.ac.cn \
/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®