From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, vkoul@kernel.org,
Frank.Li@kernel.org
Subject: Re: [PATCH 2/3] dmaengine: fsl-edma: use BIT_ULL for 64-bit channel mask
Date: Mon, 23 Nov 2026 01:34:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-228521@kernel.org> (raw)
In-Reply-To: <20261123-edma-fixes-v1-2-59d5da374a16@nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dmaengine: fsl-edma: missing Fixes: trailer for chan_masked
BIT_ULL() fix
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Critical] dmaengine: fsl-edma: use-after-free in
fsl_edma3_detach_pd() [1]
--
commit 61ad7f34b4fcfc1b5709f370095dce7e4b0ea1d5
Author: Peng Fan <peng.fan@nxp.com>
> dmaengine: fsl-edma: use BIT_ULL for 64-bit channel mask
>
> chan_masked is a u64 bitmap, but several checks use BIT(), which uses
> unsigned long and overflows on 32-bit architectures for channels >= 32.
> Use BIT_ULL() so the upper channels are tested correctly.
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
[Severity: Low]
This fixes the 32-bit BIT() overflow on the 64-bit chan_masked bitmap
introduced in commit 72f5801a4e2b ("dmaengine: fsl-edma: integrate v3
support") and replicated in commits 2838a897654c ("dmaengine: fsl-edma: Do
not suspend and resume the masked dma channel when the system is
sleeping"), ccfa3131d4a0 ("dmaengine: fsl-edma: implement the cleanup path
of fsl_edma3_attach_pd()"), and d175222f5e90 ("dmaegnine: fsl-edma: add
edma error interrupt handler"). Should this include a Fixes: tag for
72f5801a4e2b ("dmaengine: fsl-edma: integrate v3 support") (and optionally
for the follow-up commits)?
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 7f82dcb7831d0..818b9b986f131 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
[ ... ]
> @@ -641,7 +641,7 @@ static void fsl_edma3_detach_pd(struct fsl_edma_engine *fsl_edma)
> int i;
>
> for (i = 0; i < fsl_edma->n_chans; i++) {
> - if (fsl_edma->chan_masked & BIT(i))
> + if (fsl_edma->chan_masked & BIT_ULL(i))
> continue;
> fsl_chan = &fsl_edma->chans[i];
> if (fsl_chan->pd_dev_link)
[Severity: Critical]
This problem wasn't introduced by this patch, but does
fsl_edma3_detach_pd() trigger a use-after-free on fsl_chan->pd_dev
[1]?
drivers/dma/fsl-edma-main.c:fsl_edma3_detach_pd() {
...
if (fsl_chan->pd_dev_link)
device_link_del(fsl_chan->pd_dev_link);
if (fsl_chan->pd_dev) {
dev_pm_domain_detach(fsl_chan->pd_dev, false);
pm_runtime_dont_use_autosuspend(fsl_chan->pd_dev);
pm_runtime_set_suspended(fsl_chan->pd_dev);
}
...
}
After device_link_del() removes the stateless device link,
dev_pm_domain_detach() calls genpd_dev_pm_detach() -> device_unregister(),
which drops the last reference to the virtual genpd device and frees
fsl_chan->pd_dev. The subsequent pm_runtime_dont_use_autosuspend() and
pm_runtime_set_suspended() calls then lock and modify the freed device
during an attach error, probe failure, or driver unbind.
[1] https://sashiko.dev/#/bug/linux-274f4f33-0d23-4b6b-a957-25b9d8ad2f6a
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-edma-fixes-v1-0-59d5da374a16@nxp.com?part=2
next prev parent reply other threads:[~2026-11-23 1:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 1:32 [PATCH 0/3] dmaengine: edma: fix vchan cleanup and improvement Peng Fan (OSS)
2026-11-23 1:32 ` [PATCH 1/3] dmaengine: fsl-edma: unregister channels before vchan cleanup Peng Fan (OSS)
2026-11-23 1:32 ` [PATCH 2/3] dmaengine: fsl-edma: use BIT_ULL for 64-bit channel mask Peng Fan (OSS)
2026-11-23 1:34 ` sashiko-bot [this message]
2026-11-23 1:32 ` [PATCH 3/3] dmaengine: fsl-edma: use dmaengine_get_dma_device() Peng Fan (OSS)
2026-11-23 1:34 ` sashiko-bot
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-228521@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=peng.fan@oss.nxp.com \
--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