summaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/perf_event.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-07-07 18:17:05 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-07-17 15:08:38 +0100
commit8e0c34b0d268f10d84cb3f79f59c140d545a553a (patch)
tree224645cb6eca4979c8737795a9c9826257bc0ac5 /arch/arm/kernel/perf_event.c
parentdf9de3c4295afa45d9c58c3d9039098af5765a21 (diff)
downloadop-kernel-dev-8e0c34b0d268f10d84cb3f79f59c140d545a553a.zip
op-kernel-dev-8e0c34b0d268f10d84cb3f79f59c140d545a553a.tar.gz
ARM: 8402/1: 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> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/perf_event.c')
-rw-r--r--arch/arm/kernel/perf_event.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 357f57e..54272e0 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -818,12 +818,13 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
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;
cpumask_set_cpu(cpu, &pmu->supported_cpus);
OpenPOWER on IntegriCloud