genirq: Warn if enable_irq is called before irq is set up
authorThomas Gleixner <tglx@linutronix.de>
Fri, 22 Oct 2010 12:47:57 +0000 (14:47 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 22 Oct 2010 14:10:29 +0000 (16:10 +0200)
The recent changes in the genirq core unearthed a bug in arch/um which
called enable_irq() before the interrupt was set up.

Warn and return instead of crashing the machine with a NULL pointer
dereference.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Weinberger <richard@nod.at>
kernel/irq/manage.c

index 644e8d5..5f92acc 100644 (file)
@@ -324,6 +324,10 @@ void enable_irq(unsigned int irq)
        if (!desc)
                return;
 
+       if (WARN(!desc->irq_data.chip || !desc->irq_data.chip->irq_enable,
+           KERN_ERR "enable_irq before setup/request_irq: irq %u\n", irq))
+               return;
+
        chip_bus_lock(desc);
        raw_spin_lock_irqsave(&desc->lock, flags);
        __enable_irq(desc, irq, false);