From: sashiko-bot@kernel.org
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, Frank.Li@kernel.org,
imx@lists.linux.dev
Subject: Re: [PATCH] dmaengine: fl1-edma: Add error handling for devm_kasprintf
Date: Mon, 06 Jul 2026 15:10:14 +0000 [thread overview]
Message-ID: <20260706151015.269FF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <2026070605-frying-fling-b9c5@gregkh>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver masks `-EPROBE_DEFER` from both `platform_get_irq()` and `platform_get_irq_optional()`.
- [High] Missing explicit cleanup of `txirq_16_31` in `fsl_edma_irq_exit()` creates a race condition during module removal.
- [High] Use of `BIT()` instead of `BIT_ULL()` with a `u64` bitmask causes shift out of bounds on 32-bit platforms.
--
commit dcca75c04a71e337392f5a5707b96105b925f750
Author: Griffin Kroah-Hartman <griffin@kroah.com>
dmaengine: fl1-edma: Add error handling for devm_kasprintf
Add error handling statement to fls_edma3_irq_init() for the
devm_kasprintf call.
> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> index 36155ab1602a9..d9fb717b5b53c 100644
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
> @@ -414,6 +414,8 @@ static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi
>
> errirq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-err",
> dev_name(&pdev->dev));
> + if (!errirq_name)
> + return -ENOMEM;
>
> ret = devm_request_irq(&pdev->dev, fsl_edma->errirq, fsl_edma3_err_handler_shared,
> 0, errirq_name, fsl_edma);
[Severity: High]
This isn't a bug introduced by this patch, but while modifying
fsl_edma3_irq_init(), does the driver mask -EPROBE_DEFER from
platform_get_irq() and platform_get_irq_optional()?
drivers/dma/fsl-edma-main.c:fsl_edma3_irq_init() {
...
fsl_chan->txirq = platform_get_irq(pdev, i);
if (fsl_chan->txirq < 0)
return -EINVAL;
...
fsl_edma->errirq = platform_get_irq_optional(pdev, fsl_edma->n_chans);
if (fsl_edma->errirq < 0)
return 0; /* dts miss err irq, treat as no err irq case */
...
}
If either of these functions return -EPROBE_DEFER because the IRQ controller
is not yet ready, discarding the error code converts a recoverable probe
deferral into a permanent initialization failure or a silent missing interrupt.
[Severity: High]
This is a pre-existing issue, but can the chan_masked check result in an
out-of-bounds shift on 32-bit platforms?
drivers/dma/fsl-edma-main.c:fsl_edma3_irq_init() {
...
for (i = 0; i < fsl_edma->n_chans; i++) {
...
if (fsl_edma->chan_masked & BIT(i))
continue;
...
}
Since chan_masked is a u64, using BIT(i) instead of BIT_ULL(i) produces an
unsigned long.
On 32-bit architectures, this evaluates incorrectly for channels 32-63,
proceeding with initialization for channels that should have been masked off.
[Severity: High]
This is a pre-existing issue, but is there a race condition during module
removal due to missing cleanup of txirq_16_31?
drivers/dma/fsl-edma-main.c:fsl_edma_remove() {
...
fsl_edma_irq_exit(pdev, fsl_edma);
fsl_edma_cleanup_vchan(&fsl_edma->dma_dev);
...
}
During fsl_edma_remove(), the driver attempts to silence interrupts
by calling devm_free_irq() in fsl_edma_irq_exit():
drivers/dma/fsl-edma-main.c:fsl_edma_irq_exit() {
...
(missing explicit free of txirq_16_31)
...
}
If fsl_edma_irq_exit() fails to free fsl_edma->txirq_16_31, an interrupt
can fire for channels 16-31 while fsl_edma_cleanup_vchan() is tearing down
the virtual channels.
Could this cause the handler to execute on partially destroyed state?
--
Sashiko AI review · https://sashiko.dev/#/patchset/2026070605-frying-fling-b9c5@gregkh?part=1
next prev parent reply other threads:[~2026-07-06 15:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 14:57 [PATCH] dmaengine: fl1-edma: Add error handling for devm_kasprintf Greg Kroah-Hartman
2026-07-06 15:10 ` sashiko-bot [this message]
2026-07-06 16:31 ` 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=20260706151015.269FF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.