Skip to content

Commit

Permalink
ARM: 7185/1: perf: don't assign platform_device on unsupported CPUs
Browse files Browse the repository at this point in the history
In the unlikely case that a platform registers a PMU platform_device
when running on a CPU that is unsupported by perf, we will encounter a
NULL dereference when trying to assign the platform_device to the
cpu_pmu structure.

This patch checks that the CPU is supported by perf before assigning
the platform_device.

Reported-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Will Deacon authored and Russell King committed Dec 6, 2011
1 parent de66a97 commit 6bd0540
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ static struct platform_device_id armpmu_plat_device_ids[] = {

static int __devinit armpmu_device_probe(struct platform_device *pdev)
{
if (!cpu_pmu)
return -ENODEV;

cpu_pmu->plat_device = pdev;
return 0;
}
Expand Down

0 comments on commit 6bd0540

Please sign in to comment.