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

Commit be406ddb authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: cpuidle: lpm-levels: Fix untrusted pointer dereference."

parents 4572d9af 44dab19e
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -737,26 +737,22 @@ static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)

void free_cluster_node(struct lpm_cluster *cluster)
{
	struct list_head *list;
	struct lpm_cpu *cpu, *n;
	int i;
	struct lpm_cluster *cl, *m;

	list_for_each(list, &cluster->child) {
		struct lpm_cluster *n;

		n = list_entry(list, typeof(*n), list);
		list_del(list);
		free_cluster_node(n);
	list_for_each_entry_safe(cl, m, &cluster->child, list) {
		list_del(&cl->list);
		free_cluster_node(cl);
	};

	list_for_each_entry_safe(cpu, n, &cluster->cpu, list) {
		struct lpm_cpu *cpu = list_entry(list, typeof(*cpu), list);
		int i;

		list_del(&cpu->list);
		for (i = 0; i < cpu->nlevels; i++) {
			kfree(cpu->levels[i].name);
			cpu->levels[i].name = NULL;
		}
		list_del(list);
	}
}