Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1471221 > unrolled thread

[PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe

Started byStefan Wahren <stefan.wahren@i2se.com>
First post2016-08-27 18:30 +0200
Last post2016-09-01 04:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe Stefan Wahren <stefan.wahren@i2se.com> - 2016-08-27 18:30 +0200
    Re: [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference  during probe Will Deacon <will.deacon@arm.com> - 2016-08-30 13:30 +0200
      Re: [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe Kevin Hilman <khilman@baylibre.com> - 2016-09-01 04:20 +0200

#1471221 — [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe

FromStefan Wahren <stefan.wahren@i2se.com>
Date2016-08-27 18:30 +0200
Subject[PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe
Message-ID<saOEz-6Oq-63@gated-at.bofh.it>
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.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: 7f1d642fbb5c ("drivers/perf: arm-pmu: Fix handling of SPI lacking \"interrupt-affinity\" property")
---
 drivers/perf/arm_pmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Note: checkpatch.pl complains about the fixes tag, but i don't know how to
escape it correctly.

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 1b48bf0..f5e1008 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -970,7 +970,7 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
 	if (cpumask_weight(&pmu->supported_cpus) == 0) {
 		int irq = platform_get_irq(pdev, 0);
 
-		if (irq_is_percpu(irq)) {
+		if (irq >= 0 && irq_is_percpu(irq)) {
 			/* If using PPIs, check the affinity of the partition */
 			int ret;
 
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1472422 — Re: [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe

FromWill Deacon <will.deacon@arm.com>
Date2016-08-30 13:30 +0200
SubjectRe: [PATCH 2/2] drivers/perf: arm_pmu: Fix NULL pointer dereference during probe
Message-ID<sbPoR-47R-3@gated-at.bofh.it>
In reply to#1471221
On Sat, Aug 27, 2016 at 04:19:50PM +0000, Stefan Wahren wrote:
> 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.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> Fixes: 7f1d642fbb5c ("drivers/perf: arm-pmu: Fix handling of SPI lacking \"interrupt-affinity\" property")
> ---
>  drivers/perf/arm_pmu.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, these two look good to me. I'll queue them up as fixes and hopefully
they'll land in -rc5.

Will

[toc] | [prev] | [next] | [standalone]


#1474023

FromKevin Hilman <khilman@baylibre.com>
Date2016-09-01 04:20 +0200
Message-ID<scpLH-2as-1@gated-at.bofh.it>
In reply to#1472422
Will Deacon <will.deacon@arm.com> writes:

> On Sat, Aug 27, 2016 at 04:19:50PM +0000, Stefan Wahren wrote:
>> 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.
>> 
>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>> Fixes: 7f1d642fbb5c ("drivers/perf: arm-pmu: Fix handling of SPI lacking \"interrupt-affinity\" property")
>> ---
>>  drivers/perf/arm_pmu.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Thanks, these two look good to me. I'll queue them up as fixes and hopefully
> they'll land in -rc5.

FWIW, I tested this on bcm2835-rpi and verified it fixes the boot
problem in mainline.

Tested-by: Kevin Hilman <khilman@baylibre.com>

Kevin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web