From: Stephen Boyd Date: Wed, 3 Jun 2015 20:53:37 +0000 (+0100) Subject: arm64: perf: Don't use of_node after putting it X-Git-Tag: v4.2-rc1~18^2~5 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=18a11b5e79697ddc61e30181737c91ce21eaa859;p=karo-tx-linux.git 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 Signed-off-by: Will Deacon --- diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 702591f6180a..8af7784a8e35 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -1340,12 +1340,13 @@ static int armpmu_device_probe(struct platform_device *pdev) if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL)) break; - of_node_put(dn); if (cpu >= nr_cpu_ids) { pr_warn("Failed to find logical CPU for %s\n", dn->name); + of_node_put(dn); break; } + of_node_put(dn); irqs[i] = cpu; }