History

drivers/perf: arm_pmu: Fix NULL pointer dereference during probe

Patch 7f1d642fbb5c ("drivers/perf: arm-pmu: Fix handling of SPI lacking interrupt-affinity property") unintended also fixes perf_event support for bcm2835 which doesn't have PMU interrupts. Unfortunately this change introduce a NULL pointer dereference on bcm2835, because irq_is_percpu always expected to be called with a valid IRQ. So fix this regression by validating the IRQ before.

Stefan Wahren committed 10 years ago

Commit 63fb0a91 parent 75324681 file · +1 −1Browse files

Unified · Split

drivers/perf/arm_pmu.c+1−1
@@ -970,7 +970,7 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu) · 969 unmodified lines
970970 if (cpumask_weight(&pmu->supported_cpus) == 0) {
971971 int irq = platform_get_irq(pdev, 0);
972972
973− if (irq_is_percpu(irq)) {
973+ if (irq >= 0 && irq_is_percpu(irq)) {
974974 /* If using PPIs, check the affinity of the partition */
975975 int ret;
976976