All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hongling Zeng" <zenghongling@kylinos.cn>
Cc: dmaengine@vger.kernel.org, Frank.Li@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH RESEND v2] dma: at_hdmac: Use stored IRQ in error path
Date: Mon, 27 Jul 2026 06:41:05 +0000	[thread overview]
Message-ID: <20260727064105.8E5111F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727062917.46905-1-zenghongling@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing tasklet_kill() in the device remove path can lead to Use-After-Free if the device is forcibly unbound.
--

--- Patch [1]: [PATCH RESEND v2] dma: at_hdmac: Use stored IRQ in error path ---
commit a2d04416b94efa75bbae4e7c156c0d75fc20608a
Author: Hongling Zeng <zenghongling@kylinos.cn>

dma: at_hdmac: Use stored IRQ in error path

When request_irq() succeeds but a later error occurs in at_dma_probe(),
the error handling path attempts to free the IRQ by calling
platform_get_irq() again. This commit updates the error handling path
to use the previously stored irq variable instead, clarifying the code
and resolving warnings.

> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e5b30a57c477a..2a860679b9e1c 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c

[ ... ]

This is a pre-existing issue, but while reviewing the IRQ and teardown
changes in this file, I noticed a potential problem in at_dma_remove():

drivers/dma/at_hdmac.c:at_dma_remove() {
    ...
	list_for_each_entry_safe(chan, _chan, &atdma->dma_device.channels,
			device_node) {
		/* Disable interrupts */
		atc_disable_chan_irq(atdma, chan->chan_id);
		list_del(&chan->device_node);
	}
    ...
}

[Severity: High]
Does this code miss a call to tasklet_kill() for the virtual DMA tasklet?

If a device unbind occurs while a DMA transaction is active, and the DMA
interrupt fires just before free_irq() is called in at_dma_remove(), the
interrupt handler will schedule the virtual DMA tasklet.

Since tasklet_kill() is not called to cancel pending tasklets before
returning, the tasklet remains queued on the CPU softirq list. Once
at_dma_remove() completes and the devres subsystem automatically frees
the atdma memory structure, the tasklet will subsequently execute and
access the freed virt_dma_chan memory. Can this lead to a Use-After-Free?

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

      reply	other threads:[~2026-07-27  6:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  6:29 [PATCH RESEND v2] dma: at_hdmac: Use stored IRQ in error path Hongling Zeng
2026-07-27  6:41 ` sashiko-bot [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=20260727064105.8E5111F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.