Skip to content

Commit

Permalink
irqchip/gic-v3: Fix ppi-partitions lookup
Browse files Browse the repository at this point in the history
Fix child-node lookup during initialisation, which ended up searching
the whole device tree depth-first starting at the parent rather than
just matching on its children.

To make things worse, the parent gic node was prematurely freed, while
the ppi-partitions node was leaked.

Fixes: e3825ba ("irqchip/gic-v3: Add support for partitioned PPIs")
Cc: stable <[email protected]>     # 4.7
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
  • Loading branch information
jhovold authored and Marc Zyngier committed Nov 12, 2017
1 parent 90dc712 commit 00ee9a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/irqchip/irq-gic-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,18 +1103,18 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
int nr_parts;
struct partition_affinity *parts;

parts_node = of_find_node_by_name(gic_node, "ppi-partitions");
parts_node = of_get_child_by_name(gic_node, "ppi-partitions");
if (!parts_node)
return;

nr_parts = of_get_child_count(parts_node);

if (!nr_parts)
return;
goto out_put_node;

parts = kzalloc(sizeof(*parts) * nr_parts, GFP_KERNEL);
if (WARN_ON(!parts))
return;
goto out_put_node;

for_each_child_of_node(parts_node, child_part) {
struct partition_affinity *part;
Expand Down Expand Up @@ -1181,6 +1181,9 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)

gic_data.ppi_descs[i] = desc;
}

out_put_node:
of_node_put(parts_node);
}

static void __init gic_of_setup_kvm_info(struct device_node *node)
Expand Down

0 comments on commit 00ee9a1

Please sign in to comment.