Patchwork [1/3] powerpc: kdump: Fix NULL pointer dereference in irq disable code

login
register
mail settings
Submitter Anton Blanchard
Date May 11, 2010, 2:23 a.m.
Message ID <20100511022329.GE12203@kryten>
Download mbox | patch
Permalink /patch/52275/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Anton Blanchard - May 11, 2010, 2:23 a.m.
With sparse irqs we have to check if we have a descriptor before dereferencing
it.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
Michael Ellerman - May 11, 2010, 4:14 a.m.
On Tue, 2010-05-11 at 12:23 +1000, Anton Blanchard wrote:
> With sparse irqs we have to check if we have a descriptor before dereferencing
> it.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
> index 6f4613d..5182439 100644
> --- a/arch/powerpc/kernel/crash.c
> +++ b/arch/powerpc/kernel/crash.c
> @@ -375,6 +375,9 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
>  	for_each_irq(i) {
>  		struct irq_desc *desc = irq_to_desc(i);
>  
> +		if (!desc)
> +			continue;
> +
>  		if (desc->status & IRQ_INPROGRESS)
>  			desc->chip->eoi(i);
>  

Ouch, my bad.

cheers

Patch

diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 6f4613d..5182439 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -375,6 +375,9 @@  void default_machine_crash_shutdown(struct pt_regs *regs)
 	for_each_irq(i) {
 		struct irq_desc *desc = irq_to_desc(i);
 
+		if (!desc)
+			continue;
+
 		if (desc->status & IRQ_INPROGRESS)
 			desc->chip->eoi(i);