From: sashiko-bot@kernel.org
To: "Tian Xuechen" <202300460064@mail.sdu.edu.cn>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 1/2] dmaengine: ti: k3-udma: Withdraw the DMA providers on removal
Date: Sat, 28 Nov 2026 11:14:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-238652@kernel.org> (raw)
In-Reply-To: <20261128110224.875369-2-202300460064@mail.sdu.edu.cn>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] dmaengine: ti: k3-udma: missing workqueue cancellation in
udma_driver [1]
--
commit c1fb8f8e2baaa454720ded377f244f55b66ebe93
Author: Tian Xuechen <202300460064@mail.sdu.edu.cn>
dmaengine: ti: k3-udma: Withdraw the DMA providers on removal
This commit switches the DMA device and OF DMA controller registrations in
udma_probe() to devres-managed helpers so they are unregistered on driver
removal.
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index 75bd1977fb423..1349585711b80 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -5619,7 +5619,7 @@ static int udma_probe(struct platform_device *pdev)
> /* Configure the copy_align to the maximum burst size the device supports */
> ud->ddev.copy_align = udma_get_copy_align(ud);
>
> - ret = dma_async_device_register(&ud->ddev);
> + ret = dmaenginem_async_device_register(&ud->ddev);
> if (ret) {
> dev_err(dev, "failed to register slave DMA engine: %d\n", ret);
> return ret;
> @@ -5627,11 +5627,9 @@ static int udma_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, ud);
>
> - ret = of_dma_controller_register(dev->of_node, udma_of_xlate, ud);
> - if (ret) {
> + ret = devm_of_dma_controller_register(dev, dev->of_node, udma_of_xlate, ud);
> + if (ret)
> dev_err(dev, "failed to register of_dma controller\n");
> - dma_async_device_unregister(&ud->ddev);
> - }
>
> return ret;
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but can unloading the module
leave ud->purge_work or uc->tx_drain.work pending after devres frees
struct udma_dev [1]?
udma_probe() allocates ud and its channels with devm_kzalloc() and
initializes ud->purge_work (udma_purge_desc_work()) and uc->tx_drain.work
(udma_check_tx_completion()), while udma_driver has no .remove callback
and registers no devm action to cancel them. If the module is unloaded
while either work item is queued, the worker can run after devres frees ud
and cause a use-after-free.
[1] https://sashiko.dev/#/bug/linux-ab017a54-94b4-4224-b85f-161bcb4066df
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261128110224.875369-1-202300460064@mail.sdu.edu.cn?part=1
next prev parent reply other threads:[~2026-11-28 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 11:02 [PATCH 0/2] dmaengine: ti: Withdraw DMA providers on removal Tian Xuechen
2026-11-28 11:02 ` [PATCH 1/2] dmaengine: ti: k3-udma: Withdraw the " Tian Xuechen
2026-11-28 11:14 ` sashiko-bot [this message]
2026-11-28 11:02 ` [PATCH 2/2] dmaengine: ti-dma-crossbar: Unregister the DMA router " Tian Xuechen
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-238652@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=202300460064@mail.sdu.edu.cn \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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