Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bd05409 authored by Will Deacon's avatar Will Deacon Committed by Russell King
Browse files

ARM: 7185/1: perf: don't assign platform_device on unsupported CPUs



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: default avatarPawel Moll <pawel.moll@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent de66a979
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -640,6 +640,9 @@ static struct platform_device_id armpmu_plat_device_ids[] = {


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

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