Skip to content

Commit

Permalink
genirq: Warn if enable_irq is called before irq is set up
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner committed Oct 22, 2010
1 parent d4429f6 commit 2656c36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2656c36

Please sign in to comment.