Skip to content

Commit

Permalink
ARM: 8402/1: perf: Don't use of_node after putting it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Boyd authored and Russell King committed Jul 17, 2015
1 parent df9de3c commit 8e0c34b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8e0c34b

Please sign in to comment.