public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
@ 2012-05-03 10:12 Thomas Gleixner
  2012-05-03 10:22 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2012-05-03 10:12 UTC (permalink / raw)
  To: LKML; +Cc: Felix Radensky, Thomas Wucher, Kumar Gala, Grant Likely

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.

Reported-by: Thomas Wucher <twucher@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Felix Radensky <felix@embedded-sol.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: stable@vger.kernel.org
---
 drivers/gpio/gpio-mpc8xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
===================================================================
--- linux-2.6.orig/drivers/gpio/gpio-mpc8xxx.c
+++ 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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
  2012-05-03 10:12 [PATCH] gpio: mpc8xxx: Prevent NULL pointer deref in demux handler Thomas Gleixner
@ 2012-05-03 10:22 ` Thomas Gleixner
  2012-05-18 22:40   ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2012-05-03 10:22 UTC (permalink / raw)
  To: LKML; +Cc: Felix Radensky, Thomas Wucher, Kumar Gala, Grant Likely

This time with the correct CC of the reporter :)

-------------->
Subject: gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
From: Thomas Gleixner <tglx@linutronix.de>
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.

Reported-by: Thomas Wucher <thwucher@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Felix Radensky <felix@embedded-sol.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: stable@vger.kernel.org
---
 drivers/gpio/gpio-mpc8xxx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
===================================================================
--- linux-2.6.orig/drivers/gpio/gpio-mpc8xxx.c
+++ 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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
  2012-05-03 10:22 ` Thomas Gleixner
@ 2012-05-18 22:40   ` Grant Likely
  0 siblings, 0 replies; 3+ messages in thread
From: Grant Likely @ 2012-05-18 22:40 UTC (permalink / raw)
  To: Thomas Gleixner, LKML; +Cc: Felix Radensky, Thomas Wucher, Kumar Gala

On Thu, 3 May 2012 12:22:06 +0200 (CEST), Thomas Gleixner <tglx@linutronix.de> wrote:
> This time with the correct CC of the reporter :)

Applied, thanks.

g.

> 
> -------------->
> Subject: gpio: mpc8xxx: Prevent NULL pointer deref in demux handler
> From: Thomas Gleixner <tglx@linutronix.de>
> 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.
> 
> Reported-by: Thomas Wucher <thwucher@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Felix Radensky <felix@embedded-sol.com>
> Cc: Kumar Gala <galak@kernel.crashing.org>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpio/gpio-mpc8xxx.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/drivers/gpio/gpio-mpc8xxx.c
> ===================================================================
> --- linux-2.6.orig/drivers/gpio/gpio-mpc8xxx.c
> +++ 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)

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-18 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 10:12 [PATCH] gpio: mpc8xxx: Prevent NULL pointer deref in demux handler Thomas Gleixner
2012-05-03 10:22 ` Thomas Gleixner
2012-05-18 22:40   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox