[tip: irq/drivers] irqchip/gic-v3: Release the partition node in gic_irq_get_fwspec_info()

From: tip-bot2 for Fuad Tabba

Date: Thu Oct 15 2026 - 06:03:33 EST


The following commit has been merged into the irq/drivers branch of tip:

Commit-ID: 0773b76611e9c596c825076d422d372697da9940
Gitweb: https://git.kernel.org/tip/0773b76611e9c596c825076d422d372697da9940
Author: Fuad Tabba <fuad.tabba@xxxxxxxxx>
AuthorDate: Tue, 08 Sep 2026 15:26:30 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Thu, 15 Oct 2026 11:50:47 +02:00

irqchip/gic-v3: Release the partition node in gic_irq_get_fwspec_info()

gic_irq_get_fwspec_info() never puts the node it takes from
of_find_node_by_phandle(), so every lookup from a four-cell PPI or EPPI
specifier naming a partition leaks one.

The node is only used for the comparison against gic_data.parts[], and
the mask returned points into gic_data, so it can go out of scope with
the lookup.

Fixes: 68905ea65ceff ("irqchip/gic-v3: Add FW info retrieval support")
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx>
Reviewed-by: Zenghui Yu (Huawei) <zenghui.yu@xxxxxxxxx>
Reviewed-by: Radu Rendec <radu@xxxxxxxxxx>
Link: https://patch.msgid.link/20260908142632.2795308-2-fuad.tabba@xxxxxxxxx
---
drivers/irqchip/irq-gic-v3.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 19a15c2..9231688 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1728,8 +1728,6 @@ static int gic_irq_get_fwspec_info(struct irq_fwspec *fwspec, struct irq_fwspec_

/* If the specifier provides an affinity, use it */
if (fwspec->param_count == 4 && fwspec->param[3]) {
- struct fwnode_handle *fw;
-
switch (fwspec->param[0]) {
case 1: /* PPI */
case 3: /* EPPI */
@@ -1738,7 +1736,10 @@ static int gic_irq_get_fwspec_info(struct irq_fwspec *fwspec, struct irq_fwspec_
return 0;
}

- fw = of_fwnode_handle(of_find_node_by_phandle(fwspec->param[3]));
+ struct device_node *np __free(device_node) =
+ of_find_node_by_phandle(fwspec->param[3]);
+ struct fwnode_handle *fw = of_fwnode_handle(np);
+
if (!fw)
return -ENOENT;