[PATCH 1/3] irqchip/gic-v3: Release the partition node in gic_irq_get_fwspec_info()
Fuad Tabba
fuad.tabba at linux.dev
Tue Sep 8 07:26:30 PDT 2026
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 at linux.dev>
---
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 6e1fa5b247fc4..b0142b0a93fa4 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;
--
2.39.5
More information about the linux-arm-kernel
mailing list