From: Will Deacon Date: Tue, 22 Nov 2011 18:01:46 +0000 (+0000) Subject: ARM: perf: check that we have a platform device when reserving PMU X-Git-Tag: MMI-PSA29.97-13-9~17942^2~11^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e5a21327644adba32816f74a415114d11c57f2e9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ARM: perf: check that we have a platform device when reserving PMU Attempting to use a hardware counter on a platform with a supported PMU but where the platform_device (defining the interrupts) has not been registered results in a NULL pointer dereference. This patch fixes the problem by checking that we actually have a platform device registered before attempting to grab the interrupts. Reported-by: Pawel Moll Signed-off-by: Will Deacon --- diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index e508066d3d64..c475379199b1 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -402,6 +402,9 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu) int i, err, irq, irqs; struct platform_device *pmu_device = armpmu->plat_device; + if (!pmu_device) + return -ENODEV; + err = reserve_pmu(armpmu->type); if (err) { pr_warning("unable to reserve pmu\n");