From: sashiko-bot@kernel.org
To: "Ziheng Wei" <zihengw03@163.com>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH] dmaengine: mediatek: mtk-cqdma: fix list entry type and locking in tx_status
Date: Mon, 30 Nov 2026 10:45:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-240880@kernel.org> (raw)
In-Reply-To: <20261130103317.1383850-1-zihengw03@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] dmaengine: mediatek: missing channel check in
mtk_cqdma_find_active_desc()
--
commit 1493321485f8d0688e40f18ce0044f36476d4227
Author: Ziheng Wei <zihengw03@163.com>
dmaengine: mediatek: mtk-cqdma: fix list entry type and locking in tx_status
This commit updates mtk_cqdma_find_active_desc() to iterate over pc->queue
using struct mtk_cqdma_vdesc instead of struct virt_dma_desc, and moves the
cvd->residue read in mtk_cqdma_tx_status() inside the spinlock critical
section.
> diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
> index a7000608ddeac..61fd98a9206b0 100644
> --- a/drivers/dma/mediatek/mtk-cqdma.c
> +++ b/drivers/dma/mediatek/mtk-cqdma.c
> @@ -419,12 +419,12 @@ static struct virt_dma_desc *mtk_cqdma_find_active_desc(struct dma_chan *c,
> dma_cookie_t cookie)
> {
> struct mtk_cqdma_vchan *cvc = to_cqdma_vchan(c);
> + struct mtk_cqdma_vdesc *cvd;
> struct virt_dma_desc *vd;
>
> - list_for_each_entry(vd, &cvc->pc->queue, node)
> - if (vd->tx.cookie == cookie) {
> - return vd;
> - }
> + list_for_each_entry(cvd, &cvc->pc->queue, node)
> + if (cvd->vd.tx.cookie == cookie)
> + return &cvd->vd;
[Severity: Medium]
Can this match a descriptor belonging to a different virtual channel?
Up to 32 virtual channels are multiplexed across 3 physical channels and
share cvc->pc->queue, while each virtual channel assigns cookies from its
own per-channel counter starting at DMA_MIN_COOKIE. Unlike
mtk_cqdma_is_vchan_active(), this loop does not check that cvd->ch == c, so
mtk_cqdma_tx_status() can match another virtual channel's active descriptor
with the same cookie and report the wrong residue.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130103317.1383850-1-zihengw03@163.com?part=1
prev parent reply other threads:[~2026-11-30 10:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 10:33 [PATCH] dmaengine: mediatek: mtk-cqdma: fix list entry type and locking in tx_status Ziheng Wei
2026-11-30 10:45 ` 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=sashiko-outbox-240880@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=zihengw03@163.com \
/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