gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
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
@@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(unsif (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)
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
@@ -163,7 +163,8 @@ static void mpc8xxx_gpio_irq_cascade(unsif (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)
Grant Likely
AppliedQuoted 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 +0200commit 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.
Reported-by Thomas Wucher <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Cc Felix Radensky <[email protected]>Cc Kumar Gala <[email protected]>Cc Grant Likely <[email protected]>--- 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(unsif (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.