From: Frank Li <Frank.li@oss.nxp.com>
To: Lee Jones <lee@kernel.org>
Cc: Jacky Huang <ychuang3@nuvoton.com>,
Shan-Chun Hung <schung@nuvoton.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 07/11] dmaengine: arm-dma350: Query dma_cookie_status() under vc.lock in d350_tx_status()
Date: Tue, 17 Nov 2026 14:44:19 -0500 [thread overview]
Message-ID: <avyukzFVegUHvgtL@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20261117163809.622249-8-lee@kernel.org>
On Tue, Nov 17, 2026 at 04:37:08PM +0000, Lee Jones wrote:
> Calling dma_cookie_status() before acquiring dch->vc.lock in
> d350_tx_status() races with d350_irq() completing the active descriptor
> and starting the next queued transfer, causing d350_tx_status() to
> observe a stale DMA_IN_PROGRESS status and falsely return DMA_ERROR.
>
> Move the dma_cookie_status() call inside the dch->vc.lock critical
> section.
>
> Fixes: 5d099706449d ("dmaengine: Add Arm DMA-350 driver")
> Closes: https://sashiko.dev/#/bug/linux-524816d7-ed1c-4f2b-b4c3-65a7e8bb45a3
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> v1 => v2: No changes
>
> drivers/dma/arm-dma350.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/arm-dma350.c b/drivers/dma/arm-dma350.c
> index 52f5242ea332..8c1725588f1d 100644
> --- a/drivers/dma/arm-dma350.c
> +++ b/drivers/dma/arm-dma350.c
> @@ -381,9 +381,8 @@ static enum dma_status d350_tx_status(struct dma_chan *chan, dma_cookie_t cookie
> unsigned long flags;
> u32 residue = 0;
>
> + spin_lock_irqsave(&dch->vc.lock, flags);
> status = dma_cookie_status(chan, cookie, state);
> -
> - spin_lock_irqsave(&dch->vc.lock, flags);
> if (cookie == dch->cookie) {
> status = dch->status;
> if (status == DMA_IN_PROGRESS || status == DMA_PAUSED)
> --
> 2.56.0.679.gc527c65306-goog
>
next prev parent reply other threads:[~2026-11-17 19:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:37 [PATCH v2 00/11] dmaengine: Fix teardown races, resource leaks, and error handling Lee Jones
2026-11-17 16:37 ` [PATCH v2 01/11] dmaengine: pl08x: Defer OF DMA controller registration until slave setup Lee Jones
2026-11-17 18:44 ` Linus Walleij
2026-11-17 19:37 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 02/11] dmaengine: ae4dma: Let the pending work exit before cancelling it Lee Jones
2026-11-17 19:38 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 03/11] dmaengine: ae4dma: Unregister DMA engine in ae4_pci_remove() Lee Jones
2026-11-17 19:40 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 04/11] dmaengine: ptdma: Unmap descriptor in pt_do_cleanup() Lee Jones
2026-11-17 19:41 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 05/11] dmaengine: ptdma: Remove completed descriptor under vc.lock in pt_cmd_callback_work() Lee Jones
2026-11-17 19:42 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 06/11] dmaengine: amlogic: Destroy free_wq after devres DMA device unregistration Lee Jones
2026-11-17 19:43 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 07/11] dmaengine: arm-dma350: Query dma_cookie_status() under vc.lock in d350_tx_status() Lee Jones
2026-11-17 19:44 ` Frank Li [this message]
2026-11-17 16:37 ` [PATCH v2 08/11] dmaengine: bestcomm: Defer publishing bcom_eng until initialisation completes Lee Jones
2026-11-17 19:48 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 09/11] dmaengine: bestcomm: Check rh_create() return value in bcom_sram_init() Lee Jones
2026-11-17 19:49 ` Frank Li
2026-11-17 16:37 ` [PATCH v2 10/11] dmaengine: jz4780: Fix descriptor cleanup on hwdesc setup failure Lee Jones
2026-11-17 19:50 ` Frank Li
2026-11-17 19:54 ` Paul Cercueil
2026-11-17 16:37 ` [PATCH v2 11/11] dmaengine: dmatest: Avoid unsigned underflow in min_odd() Lee Jones
2026-11-17 19:51 ` Frank Li
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=avyukzFVegUHvgtL@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=schung@nuvoton.com \
--cc=stable@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=ychuang3@nuvoton.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
all inboxes | Powered by JetHome®