From: Frank Li <Frank.li@oss.nxp.com>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] dmaengine: tegra: initialize channel state before requesting IRQ
Date: Fri, 16 Oct 2026 12:40:06 -0400 [thread overview]
Message-ID: <atJTZmloabvKGOTD@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260830061213.2209331-1-runyu.xiao@seu.edu.cn>
On Sun, Aug 30, 2026 at 02:12:13PM +0800, Runyu Xiao wrote:
> tegra_dma_probe() registers a channel IRQ before initializing the
> channel lock, tasklet, waitqueue, and descriptor lists used by the
> interrupt path. A pending interrupt can therefore access uninitialized
> channel state.
>
> Prepare the channel state before requesting its IRQ so the handler and
> tasklet always see initialized synchronization and list objects.
>
> Fixes: ec8a1586780c ("dma: tegra: add dmaengine based dma driver")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/dma/tegra20-apb-dma.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index 640b8a218..23fd294ab 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -1494,6 +1494,19 @@ static int tegra_dma_probe(struct platform_device *pdev)
> }
>
> snprintf(tdc->name, sizeof(tdc->name), "apbdma.%d", i);
> + tdc->tdma = tdma;
> + tdc->id = i;
> + tdc->slave_id = TEGRA_APBDMA_SLAVE_ID_INVALID;
> +
> + tasklet_setup(&tdc->tasklet, tegra_dma_tasklet);
> + spin_lock_init(&tdc->lock);
> + init_waitqueue_head(&tdc->wq);
> +
> + INIT_LIST_HEAD(&tdc->pending_sg_req);
> + INIT_LIST_HEAD(&tdc->free_sg_req);
> + INIT_LIST_HEAD(&tdc->free_dma_desc);
> + INIT_LIST_HEAD(&tdc->cb_desc);
> +
> ret = devm_request_irq(&pdev->dev, irq, tegra_dma_isr, 0,
> tdc->name, tdc);
> if (ret) {
> @@ -1507,18 +1520,6 @@ static int tegra_dma_probe(struct platform_device *pdev)
> dma_cookie_init(&tdc->dma_chan);
> list_add_tail(&tdc->dma_chan.device_node,
> &tdma->dma_dev.channels);
> - tdc->tdma = tdma;
> - tdc->id = i;
> - tdc->slave_id = TEGRA_APBDMA_SLAVE_ID_INVALID;
> -
> - tasklet_setup(&tdc->tasklet, tegra_dma_tasklet);
> - spin_lock_init(&tdc->lock);
> - init_waitqueue_head(&tdc->wq);
> -
> - INIT_LIST_HEAD(&tdc->pending_sg_req);
> - INIT_LIST_HEAD(&tdc->free_sg_req);
> - INIT_LIST_HEAD(&tdc->free_dma_desc);
> - INIT_LIST_HEAD(&tdc->cb_desc);
> }
>
> dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
> --
> 2.34.1
prev parent reply other threads:[~2026-10-16 16:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 6:12 Runyu Xiao
2026-10-16 16:40 ` 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=atJTZmloabvKGOTD@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=jianhao.xu@seu.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=runyu.xiao@seu.edu.cn \
--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
all inboxes | Powered by JetHome®