* [PATCH v2] memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
@ 2021-09-25 15:14 Dongliang Mu
2021-10-07 18:42 ` Krzysztof Kozlowski
0 siblings, 1 reply; 2+ messages in thread
From: Dongliang Mu @ 2021-09-25 15:14 UTC (permalink / raw)
To: Krzysztof Kozlowski, Arnd Bergmann, Greg Kroah-Hartman,
Prabhakar Kushwaha
Cc: Dongliang Mu, linux-kernel
The error handling code of fsl_ifc_ctrl_probe is problematic. When
fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails,
it forgets to free the irq and nand_irq. Meanwhile, if request_irq of
fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if
the request_irq is not successful.
Fix this by refactoring the error handling code
Fixes: d2ae2e20fbdd ("driver/memory:Move Freescale IFC driver to a common driver")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
v1->v2: remove the check of nand_irq; add fixes tag;
drivers/memory/fsl_ifc.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index d062c2f8250f..75a8c38df939 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -263,7 +263,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev);
if (ret < 0)
- goto err;
+ goto err_unmap_nandirq;
init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
@@ -272,7 +272,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
if (ret != 0) {
dev_err(&dev->dev, "failed to install irq (%d)\n",
fsl_ifc_ctrl_dev->irq);
- goto err_irq;
+ goto err_unmap_nandirq;
}
if (fsl_ifc_ctrl_dev->nand_irq) {
@@ -281,17 +281,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
if (ret != 0) {
dev_err(&dev->dev, "failed to install irq (%d)\n",
fsl_ifc_ctrl_dev->nand_irq);
- goto err_nandirq;
+ goto err_free_irq;
}
}
return 0;
-err_nandirq:
- free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
- irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
-err_irq:
+err_free_irq:
free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
+err_unmap_nandirq:
+ irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
irq_dispose_mapping(fsl_ifc_ctrl_dev->irq);
err:
iounmap(fsl_ifc_ctrl_dev->gregs);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
2021-09-25 15:14 [PATCH v2] memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe Dongliang Mu
@ 2021-10-07 18:42 ` Krzysztof Kozlowski
0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2021-10-07 18:42 UTC (permalink / raw)
To: Dongliang Mu, Arnd Bergmann, Greg Kroah-Hartman, Prabhakar Kushwaha
Cc: Krzysztof Kozlowski, linux-kernel
On Sat, 25 Sep 2021 23:14:32 +0800, Dongliang Mu wrote:
> The error handling code of fsl_ifc_ctrl_probe is problematic. When
> fsl_ifc_ctrl_init fails or request_irq of fsl_ifc_ctrl_dev->irq fails,
> it forgets to free the irq and nand_irq. Meanwhile, if request_irq of
> fsl_ifc_ctrl_dev->nand_irq fails, it will still free nand_irq even if
> the request_irq is not successful.
>
> Fix this by refactoring the error handling code
>
> [...]
Applied, thanks!
[1/1] memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe
commit: 4ed2f3545c2e5acfbccd7f85fea5b1a82e9862d7
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-07 18:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 15:14 [PATCH v2] memory: fsl_ifc: fix leak of irq and nand_irq in fsl_ifc_ctrl_probe Dongliang Mu
2021-10-07 18:42 ` Krzysztof Kozlowski
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®