From: Eugen Hristev <eugen.hristev@linaro.org>
To: Qiu-ji Chen <chenqiuji666@gmail.com>,
sean.wang@mediatek.com, vkoul@kernel.org, matthias.bgg@gmail.com,
angelogioacchino.delregno@collabora.com
Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
baijiaju1990@gmail.com, stable@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status()
Date: Fri, 6 Jun 2025 10:42:11 +0300 [thread overview]
Message-ID: <ff77f70e-344d-4b8a-a27f-c8287d49339c@linaro.org> (raw)
In-Reply-To: <20250606071709.4738-1-chenqiuji666@gmail.com>
On 6/6/25 10:17, Qiu-ji Chen wrote:
> Fixed a flag reuse bug in the mtk_cqdma_tx_status() function.
>
> Fixes: 157ae5ffd76a ("dmaengine: mediatek: Fix a possible deadlock error in mtk_cqdma_tx_status()")
> Cc: stable@vger.kernel.org
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505270641.MStzJUfU-lkp@intel.com/
> Signed-off-by: Qiu-ji Chen <chenqiuji666@gmail.com>
> ---
> drivers/dma/mediatek/mtk-cqdma.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
> index 47c8adfdc155..f7b870d2ca90 100644
> --- a/drivers/dma/mediatek/mtk-cqdma.c
> +++ b/drivers/dma/mediatek/mtk-cqdma.c
> @@ -441,18 +441,19 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c,
> struct mtk_cqdma_vdesc *cvd;
> struct virt_dma_desc *vd;
> enum dma_status ret;
> - unsigned long flags;
> + unsigned long pc_flags;
> + unsigned long vc_flags;
> size_t bytes = 0;
>
> ret = dma_cookie_status(c, cookie, txstate);
> if (ret == DMA_COMPLETE || !txstate)
> return ret;
>
> - spin_lock_irqsave(&cvc->pc->lock, flags);
> - spin_lock_irqsave(&cvc->vc.lock, flags);
> + spin_lock_irqsave(&cvc->pc->lock, pc_flags);
> + spin_lock_irqsave(&cvc->vc.lock, vc_flags);
> vd = mtk_cqdma_find_active_desc(c, cookie);
> - spin_unlock_irqrestore(&cvc->vc.lock, flags);
> - spin_unlock_irqrestore(&cvc->pc->lock, flags);
> + spin_unlock_irqrestore(&cvc->vc.lock, vc_flags);
> + spin_unlock_irqrestore(&cvc->pc->lock, pc_flags);
>
> if (vd) {
> cvd = to_cqdma_vdesc(vd);
If the first spin_lock_irqsave already saved the irq flags and disabled
them, would it be meaningful to actually use a simple spin_lock for the
second lock ? Or rather spin_lock_nested since there is a second nested
lock taken ?
Eugen
next prev parent reply other threads:[~2025-06-06 7:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 7:17 [PATCH] dmaengine: mediatek: Fix a flag reuse error in mtk_cqdma_tx_status() Qiu-ji Chen
2025-06-06 7:42 ` Eugen Hristev [this message]
2025-06-06 9:14 ` Qiu-ji Chen
2025-06-06 10:00 ` Eugen Hristev
2025-06-06 17:48 ` Qiu-ji Chen
2025-06-11 13:04 ` Eugen Hristev
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=ff77f70e-344d-4b8a-a27f-c8287d49339c@linaro.org \
--to=eugen.hristev@linaro.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=baijiaju1990@gmail.com \
--cc=chenqiuji666@gmail.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lkp@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=sean.wang@mediatek.com \
--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