From: Frank Li <Frank.li@oss.nxp.com>
To: Lee Jones <lee@kernel.org>
Cc: Xianwei Zhao <xianwei.zhao@amlogic.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
linux-amlogic@lists.infradead.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 06/11] dmaengine: amlogic: Destroy free_wq after devres DMA device unregistration
Date: Tue, 17 Nov 2026 14:43:37 -0500 [thread overview]
Message-ID: <avyuaSzbqYrloiNp@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20261117163809.622249-7-lee@kernel.org>
On Tue, Nov 17, 2026 at 04:37:07PM +0000, Lee Jones wrote:
> aml_dma_probe() registers the DMA device with
> dmaenginem_async_device_register(), so dma_async_device_unregister() is
> deferred until devres release after aml_dma_remove() returns. However,
> aml_dma_remove() destroys aml_dma->free_wq directly, causing
> aml_dma_free_desc() to queue work onto a destroyed workqueue when
> channels and descriptors are released during devres teardown, and early
> error returns in aml_dma_probe() also leak aml_dma->free_wq.
>
> Allocate aml_dma->free_wq with devm_alloc_ordered_workqueue() so it is
> destroyed on probe failure and after dmaenginem_async_device_register()
> unwinds on removal.
>
> Fixes: b84b5197e344 ("dmaengine: amlogic: Add general DMA driver for A9")
> Closes: https://sashiko.dev/#/bug/linux-c216084a-f89a-48d5-bdea-584522d1bdda
> 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/amlogic-dma.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/dma/amlogic-dma.c b/drivers/dma/amlogic-dma.c
> index 684121d13fca..791bd82743d3 100644
> --- a/drivers/dma/amlogic-dma.c
> +++ b/drivers/dma/amlogic-dma.c
> @@ -620,7 +620,7 @@ static int aml_dma_probe(struct platform_device *pdev)
> if (!aml_dma)
> return -ENOMEM;
>
> - aml_dma->free_wq = alloc_ordered_workqueue("aml_dma_free", 0);
> + aml_dma->free_wq = devm_alloc_ordered_workqueue(&pdev->dev, "aml_dma_free", 0);
> if (!aml_dma->free_wq)
> return -ENOMEM;
>
> @@ -712,7 +712,6 @@ static void aml_dma_remove(struct platform_device *pdev)
> if (aml_chan)
> tasklet_kill(&aml_chan->vchan.task);
> }
> - destroy_workqueue(aml_dma->free_wq);
> }
>
> static const struct of_device_id aml_dma_ids[] = {
> --
> 2.56.0.679.gc527c65306-goog
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
prev parent reply other threads:[~2026-11-17 19:43 UTC|newest]
Thread overview: 3+ 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 06/11] dmaengine: amlogic: Destroy free_wq after devres DMA device unregistration Lee Jones
2026-11-17 19:43 ` 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=avyuaSzbqYrloiNp@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-amlogic@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=xianwei.zhao@amlogic.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®