Skip to contentSkip to conversation

gpio: mpc8xxx: Prevent NULL pointer deref in demux handler

PATCH Applied Thomas Gleixner 2 participants 3 messages May 3, 2012 – May 18, 2012 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: mpc8xxx: Prevent NULL pointer deref in demux handler

commit cfadd838(powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver) added an unconditional call of chip->irq_eoi() to the demux handler.

This leads to a NULL pointer derefernce on MPC512x platforms which use this driver as well because the underlying irq chip does not provide an irq_eoi callback.

Make it conditional.

---
 drivers/gpio/gpio-mpc8xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mpc8xxx.c +2 -1
Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
===================================================================
@@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(uns
 	if (mask)
 		generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
 						     32 - ffs(mask)));
-	chip->irq_eoi(&desc->irq_data);
+	if (chip->irq_eoi)
+		chip->irq_eoi(&desc->irq_data);
 }
 
 static void mpc8xxx_irq_unmask(struct irq_data *d)
#1 lore raw

This time with the correct CC of the reporter :)

-------------->
Subject: gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
From: Thomas Gleixner <[email protected]>
Date: Thu, 03 May 2012 11:58:09 +0200

commit cfadd838(powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver) added an unconditional call of chip->irq_eoi() to the demux handler.

This leads to a NULL pointer derefernce on MPC512x platforms which use this driver as well.

Make it conditional.

---
 drivers/gpio/gpio-mpc8xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-mpc8xxx.c +2 -1
Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
===================================================================
@@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(uns
 	if (mask)
 		generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
 						     32 - ffs(mask)));
-	chip->irq_eoi(&desc->irq_data);
+	if (chip->irq_eoi)
+		chip->irq_eoi(&desc->irq_data);
 }
 
 static void mpc8xxx_irq_unmask(struct irq_data *d)
Applied
#2 lore raw
Quoted 1 line · Thomas Gleixner

This time with the correct CC of the reporter :)

Applied, thanks.

g.

Quoted 39 lines

-------------->
Subject: gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
From: Thomas Gleixner <[email protected]>
Date: Thu, 03 May 2012 11:58:09 +0200

commit cfadd838(powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver) added an unconditional call of chip->irq_eoi() to the demux handler.

This leads to a NULL pointer derefernce on MPC512x platforms which use this driver as well.

Make it conditional.

---
 drivers/gpio/gpio-mpc8xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
===================================================================

drivers/gpio/gpio-mpc8xxx.c +2 -1
@@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(uns
 	if (mask)
 		generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
 						     32 - ffs(mask)));
-	chip->irq_eoi(&desc->irq_data);
+	if (chip->irq_eoi)
+		chip->irq_eoi(&desc->irq_data);
 }
 
 static void mpc8xxx_irq_unmask(struct irq_data *d)
Signature · 2 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.