DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hongling Zeng" <zenghongling@kylinos.cn>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v3] dma: at_hdmac: Fix use-after-free by proper tasklet cleanup
Date: Wed, 08 Jul 2026 02:37:30 +0000	[thread overview]
Message-ID: <20260708023731.237E21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708022405.24266-1-zenghongling@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Meaningful code and commit message mismatch: The v3 changelog explicitly claims to keep a defensive NULL check, but no such check exists in the code.
--

--- Patch [1]: [PATCH v3] dma: at_hdmac: Fix use-after-free by proper tasklet  cleanup ---
commit e05118b092320af0ba75bbb64dc2f10dd2eff233
Author: Hongling Zeng <zenghongling@kylinos.cn>

dma: at_hdmac: Fix use-after-free by proper tasklet cleanup

This commit fixes a use-after-free vulnerability by reordering the probe and
remove cleanup paths. It ensures that free_irq is called before killing
tasklets, preventing IRQ handlers from scheduling new tasklets on freed memory.

Closes: https://lore.kernel.org/all/20260604073945.54B311F00898@smtp.kernel.org/

> Change in v3:
> - Reorder probe error path to match remove() cleanup order
> - Keep defensive NULL check for channels cleanup

[Severity: Medium]
This isn't a bug in the code, but the changelog states a defensive NULL
check was kept for the channels cleanup.

Looking at the newly added cleanup function in the diff:

> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
[ ... ]
> +static void at_dma_cleanup_channels(struct at_dma *atdma)
> +{
> +	struct dma_chan *chan, *_chan;
> +	int i = 0;
> +
> +	list_for_each_entry_safe(chan, _chan, &atdma->dma_device.channels,
> +			device_node) {

Was the defensive check accidentally dropped in at_dma_cleanup_channels,
or does the commit message just need to be updated?

While the code appears safe because the error paths were correctly reordered
to avoid reaching this function with an uninitialized list, the changelog
mismatch might cause confusion.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708022405.24266-1-zenghongling@kylinos.cn?part=1

  reply	other threads:[~2026-07-08  2:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  2:24 [PATCH v3] dma: at_hdmac: Fix use-after-free by proper tasklet cleanup Hongling Zeng
2026-07-08  2:37 ` sashiko-bot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-07-08  2:30 Hongling Zeng
2026-07-08  2:40 ` sashiko-bot
2026-06-08  7:26 Hongling Zeng
2026-06-08  7:35 ` sashiko-bot

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=20260708023731.237E21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    --cc=zenghongling@kylinos.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