Skip to contentSkip to conversation

dmaengine: fl1-edma: Add error handling for devm_kasprintf

PATCH Applied Greg Kroah-Hartman 5 participants 10 messages Jul 6 – Jul 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: fl1-edma: Add error handling for devm_kasprintf

From: Griffin Kroah-Hartman <[email protected]>

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

---
 drivers/dma/fsl-edma-main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/fsl-edma-main.c +2 -0
index 36155ab1602a..d9fb717b5b53 100644
@@ -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);
Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

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 <[email protected]>

dmaengine: fl1-edma: Add error handling for devm_kasprintf

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

drivers/dma/fsl-edma-main.c static int fsl_edma3_irq_init(struct platform_device *pdev, struct fsl_edma_engi · line 421

Quoted 13 lines
drivers/dma/fsl-edma-main.c +2 -0
index 36155ab1602a9..d9fb717b5b53c 100644
@@ -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?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/2026070605-frying-fling-b9c5@gregkh?part=1
#2 lore raw
In reply to Greg Kroah-Hartman
Quoted 1 line · Greg Kroah-Hartman

From: Griffin Kroah-Hartman <[email protected]>

Please subject tags

dmaengine: fsl-edma: ....

Quoted 3 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

function need ()
devm_kasprintf()

Frank

Quoted 28 lines
---
 drivers/dma/fsl-edma-main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/dma/fsl-edma-main.c +2 -1
index 36155ab1602a..d9fb717b5b53 100644
@@ -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);
--

2.55.0

maintainer Applied
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 4 lines · Greg Kroah-Hartman

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

Applied, thanks!

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Best regards,

Signature · 1 line
~Vinod
#4 lore raw
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 4 lines

Applied, thanks!

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Frank Li requested a corrected patch subject.

Regards,
Markus

maintainer
#5 lore raw
Quoted 9 lines · Markus Elfring
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 4 lines

Applied, thanks!

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Frank Li requested a corrected patch subject.

Which was done while applying
bf1af4dfdc01 dmaengine: fsl-edma: Add error handling for devm_kasprintf

Signature · 1 line
~Vinod
#6 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 2 lines

Applied, thanks!

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Frank Li requested a corrected patch subject.

Which was done while applying
bf1af4dfdc01 dmaengine: fsl-edma: Add error handling for devm_kasprintf

I find it unfortunate that an improvable text was mentioned in the notification.

Did different development opinions remain if all involved function names should usually be marked with parentheses?

Regards,
Markus

#7 lore raw
Quoted 12 lines · Markus Elfring
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 2 lines

Applied, thanks!

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Frank Li requested a corrected patch subject.

Which was done while applying
bf1af4dfdc01 dmaengine: fsl-edma: Add error handling for devm_kasprintf

Quoted 7 lines

I find it unfortunate that an improvable text was mentioned in the notification.

Did different development opinions remain if all involved function names should usually be marked with parentheses?

Regards,
Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.

thanks,

greg k-h's patch email bot

#8 lore raw
In reply to Vinod Koul
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 4 lines

Applied, thanks!

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/commit/?h=next&id=bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Would it become helpful to add the following tag?

Fixes d175222f5e90b7e1f23713378823c338fabb3258 ("dmaegnine: fsl-edma: add edma error interrupt handler")

Regards,
Markus

#9 lore raw
Quoted 10 lines · Markus Elfring
Quoted 2 lines
Quoted 2 lines

Add error handling statement to fls_edma3_irq_init() for the devm_kasprintf call.

…

Quoted 4 lines

Applied, thanks!

[1/1] dmaengine: fl1-edma: Add error handling for devm_kasprintf

      commit: bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/commit/?h=next&id=bf1af4dfdc017dfe989c0dbcf0e608dc95f1d2cb

Quoted 8 lines

Would it become helpful to add the following tag?

Fixes d175222f5e90b7e1f23713378823c338fabb3258 ("dmaegnine: fsl-edma: add edma error interrupt handler")

Regards,
Markus

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.

thanks,

greg k-h's patch email bot