Skip to content

Commit fb65988

Browse files
wildea01arndb
authored andcommitted
drivers/perf: arm_pmu: avoid CPU device_node reference leak
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]>
1 parent a0bcbe9 commit fb65988

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/perf/arm_pmu.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,15 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
823823
}
824824

825825
/* Now look up the logical CPU number */
826-
for_each_possible_cpu(cpu)
827-
if (dn == of_cpu_device_node_get(cpu))
826+
for_each_possible_cpu(cpu) {
827+
struct device_node *cpu_dn;
828+
829+
cpu_dn = of_cpu_device_node_get(cpu);
830+
of_node_put(cpu_dn);
831+
832+
if (dn == cpu_dn)
828833
break;
834+
}
829835

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

0 commit comments

Comments
 (0)