* [PATCH] irqchip: Fix refcount leak in platform_irqchip_probe
@ 2023-01-02 12:13 Miaoqian Lin
2023-01-02 12:20 ` Marc Zyngier
2023-02-05 11:29 ` [irqchip: irq/irqchip-next] " irqchip-bot for Miaoqian Lin
0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2023-01-02 12:13 UTC (permalink / raw)
To: Thomas Gleixner, Marc Zyngier, Saravana Kannan, linux-kernel; +Cc: linmq006
of_irq_find_parent() returns a node pointer with refcount incremented,
We should use of_node_put() on it when not needed anymore.
Add missing of_node_put() to avoid refcount leak.
Fixes: f8410e626569 ("irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/irqchip/irqchip.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index 3570f0a588c4..7899607fbee8 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -38,8 +38,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
struct device_node *par_np = of_irq_find_parent(np);
of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev);
- if (!irq_init_cb)
+ if (!irq_init_cb) {
+ of_node_put(par_np);
return -EINVAL;
+ }
if (par_np == np)
par_np = NULL;
@@ -52,8 +54,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
* interrupt controller. The actual initialization callback of this
* interrupt controller can check for specific domains as necessary.
*/
- if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
+ if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) {
+ of_node_put(par_np);
return -EPROBE_DEFER;
+ }
return irq_init_cb(np, par_np);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] irqchip: Fix refcount leak in platform_irqchip_probe
2023-01-02 12:13 [PATCH] irqchip: Fix refcount leak in platform_irqchip_probe Miaoqian Lin
@ 2023-01-02 12:20 ` Marc Zyngier
2023-02-05 11:29 ` [irqchip: irq/irqchip-next] " irqchip-bot for Miaoqian Lin
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2023-01-02 12:20 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: Thomas Gleixner, Saravana Kannan, linux-kernel
On 2023-01-02 12:13, Miaoqian Lin wrote:
> of_irq_find_parent() returns a node pointer with refcount incremented,
> We should use of_node_put() on it when not needed anymore.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: f8410e626569 ("irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END
> and IRQCHIP_MATCH helper macros")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Please stop sending these patches one by one.
Send a series covering the whole of the irqchip subsystem, once
you have looked at all the drivers.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
* [irqchip: irq/irqchip-next] irqchip: Fix refcount leak in platform_irqchip_probe
2023-01-02 12:13 [PATCH] irqchip: Fix refcount leak in platform_irqchip_probe Miaoqian Lin
2023-01-02 12:20 ` Marc Zyngier
@ 2023-02-05 11:29 ` irqchip-bot for Miaoqian Lin
1 sibling, 0 replies; 3+ messages in thread
From: irqchip-bot for Miaoqian Lin @ 2023-02-05 11:29 UTC (permalink / raw)
To: linux-kernel; +Cc: Miaoqian Lin, Marc Zyngier, tglx
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: 6caa5a2b78f5f53c433d3a3781e53325da22f0ac
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/6caa5a2b78f5f53c433d3a3781e53325da22f0ac
Author: Miaoqian Lin <linmq006@gmail.com>
AuthorDate: Mon, 02 Jan 2023 16:13:18 +04:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 05 Feb 2023 11:07:52
irqchip: Fix refcount leak in platform_irqchip_probe
of_irq_find_parent() returns a node pointer with refcount incremented,
We should use of_node_put() on it when not needed anymore.
Add missing of_node_put() to avoid refcount leak.
Fixes: f8410e626569 ("irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper macros")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230102121318.3990586-1-linmq006@gmail.com
---
drivers/irqchip/irqchip.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index 3570f0a..7899607 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -38,8 +38,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
struct device_node *par_np = of_irq_find_parent(np);
of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev);
- if (!irq_init_cb)
+ if (!irq_init_cb) {
+ of_node_put(par_np);
return -EINVAL;
+ }
if (par_np == np)
par_np = NULL;
@@ -52,8 +54,10 @@ int platform_irqchip_probe(struct platform_device *pdev)
* interrupt controller. The actual initialization callback of this
* interrupt controller can check for specific domains as necessary.
*/
- if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
+ if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY)) {
+ of_node_put(par_np);
return -EPROBE_DEFER;
+ }
return irq_init_cb(np, par_np);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-05 11:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 12:13 [PATCH] irqchip: Fix refcount leak in platform_irqchip_probe Miaoqian Lin
2023-01-02 12:20 ` Marc Zyngier
2023-02-05 11:29 ` [irqchip: irq/irqchip-next] " irqchip-bot for Miaoqian Lin
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.