Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca655bc6 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

irqchip/gic-v3: Fix ppi-partitions lookup



commit 00ee9a1ca5080202bc37b44e998c3b2c74d45817 upstream.

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: e3825ba1 ("irqchip/gic-v3: Add support for partitioned PPIs")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c01dd3ad
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -1071,18 +1071,18 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
	int nr_parts;
	int nr_parts;
	struct partition_affinity *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)
	if (!parts_node)
		return;
		return;


	nr_parts = of_get_child_count(parts_node);
	nr_parts = of_get_child_count(parts_node);


	if (!nr_parts)
	if (!nr_parts)
		return;
		goto out_put_node;


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


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


		gic_data.ppi_descs[i] = desc;
		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)
static void __init gic_of_setup_kvm_info(struct device_node *node)