From: sashiko-bot@kernel.org
To: Frank.Li@oss.nxp.com
Cc: imx@lists.linux.dev, vkoul@kernel.org,
linux-trace-kernel@vger.kernel.org, Frank.Li@kernel.org,
linux-sunxi@lists.linux.dev, dmaengine@vger.kernel.org
Subject: Re: [PATCH v3 1/4] dmaengine: vchan: add vchan_chan_name() to get channel device name
Date: Fri, 04 Sep 2026 22:04:14 +0000 [thread overview]
Message-ID: <20260904220415.589911F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904-dma-chan_dev-rename-v3-1-685601b0b788@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Inverted devres teardown order in stm32_dma_probe error path causes a Use-After-Free of the DMA channel name.
--
commit 7119ae3e70ddf3efdd1474a7d8b5fbb1ec66bf04
Author: Frank Li <Frank.Li@nxp.com>
dmaengine: vchan: add vchan_chan_name() to get channel device name
This commit introduces the vchan_chan_name() helper to obtain the DMA channel
device name. It updates various drivers to use this helper instead of directly
accessing dma_chan::dev, ensuring they remain unaffected by upcoming struct
member renames.
[ ... ]
> diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
> index d3ad78562a140..3e8151e2ad75a 100644
> --- a/drivers/dma/stm32/stm32-dma.c
> +++ b/drivers/dma/stm32/stm32-dma.c
> @@ -1668,7 +1668,7 @@ static int stm32_dma_probe(struct platform_device *pdev)
>
> ret = devm_request_irq(&pdev->dev, chan->irq,
> stm32_dma_chan_irq, 0,
> - dev_name(chan2dev(chan)), chan);
> + vchan_chan_name(&chan->vchan), chan);
[Severity: High]
This isn't a bug introduced by this patch, but is it possible this exposes a
pre-existing use-after-free of the DMA channel name in the probe error path?
The dynamically allocated name from vchan_chan_name() is passed to
devm_request_irq(), binding the IRQ action's name pointer to the string.
If stm32_dma_probe() fails later (for example, if of_dma_controller_register()
fails), it jumps to the error label:
err_unregister:
dma_async_device_unregister(dd);
clk_free:
clk_disable_unprepare(dmadev->clk);
Calling dma_async_device_unregister() here manually frees the DMA channels
and their associated kobject names. However, because the IRQs were requested
using devm_request_irq(), they remain active and are not freed until later
when the probe function returns and devres unwinds.
Could this inverted teardown sequence create a window where the IRQ subsystem
holds a dangling pointer to the freed name string, potentially leading to
memory corruption or a kernel oops if /proc/interrupts is read?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260904-dma-chan_dev-rename-v3-0-685601b0b788@nxp.com?part=1
next prev parent reply other threads:[~2026-09-04 22:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 21:49 [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev for clarity Frank.Li
2026-09-04 21:49 ` [PATCH v3 1/4] dmaengine: vchan: add vchan_chan_name() to get channel device name Frank.Li
2026-09-04 22:04 ` sashiko-bot [this message]
2026-09-04 21:49 ` [PATCH v3 2/4] dmaengine: use dma_chan_name() helper to get per-channel " Frank.Li
2026-09-04 21:58 ` sashiko-bot
2026-09-05 7:55 ` Andy Shevchenko
2026-09-04 21:49 ` [PATCH v3 3/4] dmaengine: add (dmaengine|vchan)_chan_dev() helper Frank.Li
2026-09-04 22:02 ` sashiko-bot
2026-09-04 21:49 ` [PATCH v3 4/4] dmaengine: add union chan_dev for dma_chan::dev for clarity Frank.Li
2026-09-04 22:01 ` sashiko-bot
2026-09-05 7:59 ` Andy Shevchenko
2026-09-05 8:00 ` [PATCH v3 0/4] dmaengine: rename dma_chan::dev to dma_chan::chan_dev " Andy Shevchenko
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=20260904220415.589911F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=Frank.Li@oss.nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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