Skip to content

Commit

Permalink
drivers/perf: arm_pmu: avoid CPU device_node reference leak
Browse files Browse the repository at this point in the history
of_cpu_device_node_get increments the reference count on the CPU
device_node, so we must take care to of_node_put once we've finished
with it.

This patch fixes the perf IRQ probing code to avoid the leak.

Cc: Sudeep Holla <[email protected]>
Cc: Mark Rutland <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
wildea01 authored and arndb committed Oct 15, 2015
1 parent a0bcbe9 commit fb65988
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/perf/arm_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,15 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
}

/* Now look up the logical CPU number */
for_each_possible_cpu(cpu)
if (dn == of_cpu_device_node_get(cpu))
for_each_possible_cpu(cpu) {
struct device_node *cpu_dn;

cpu_dn = of_cpu_device_node_get(cpu);
of_node_put(cpu_dn);

if (dn == cpu_dn)
break;
}

if (cpu >= nr_cpu_ids) {
pr_warn("Failed to find logical CPU for %s\n",
Expand Down

0 comments on commit fb65988

Please sign in to comment.