arm64: perf: Don't use of_node after putting it

It's possible, albeit unlikely, that using the of_node here will
reference freed memory. Call of_node_put() after printing the
name to be safe.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
This commit is contained in:
Stephen Boyd 2015-06-03 21:53:37 +01:00 committed by Catalin Marinas
parent 1e43ba9cd8
commit 18a11b5e79

View file

@ -1340,12 +1340,13 @@ static int armpmu_device_probe(struct platform_device *pdev)
if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL)) if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
break; break;
of_node_put(dn);
if (cpu >= nr_cpu_ids) { if (cpu >= nr_cpu_ids) {
pr_warn("Failed to find logical CPU for %s\n", pr_warn("Failed to find logical CPU for %s\n",
dn->name); dn->name);
of_node_put(dn);
break; break;
} }
of_node_put(dn);
irqs[i] = cpu; irqs[i] = cpu;
} }