IRQs without IRQF_DISABLED could nest to arbitrary level. At worst this would mean having as many IRQ handlers stack frames, as there are interrupts registered --- enough to cause a stack overflow. This patch makes a limit to have at most two handlers on the stack. Signed-off-by: Mikulas Patocka --- include/linux/interrupt.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) Index: linux-2.6.31-rc4-devel/include/linux/interrupt.h =================================================================== --- linux-2.6.31-rc4-devel.orig/include/linux/interrupt.h 2009-07-28 01:54:06.000000000 +0200 +++ linux-2.6.31-rc4-devel/include/linux/interrupt.h 2009-07-28 02:08:56.000000000 +0200 @@ -21,6 +21,11 @@ #include /* + * Max number of interrupt handlers on a stack. To prevent stack overflow. + */ +#define MAX_NESTED_INTERRUPTS 2 + +/* * These correspond to the IORESOURCE_IRQ_* defines in * linux/ioport.h to select the interrupt line behaviour. When * requesting an interrupt without specifying a IRQF_TRIGGER, the @@ -178,7 +183,7 @@ extern void devm_free_irq(struct device #ifdef CONFIG_LOCKDEP # define local_irq_enable_in_hardirq() do { } while (0) #else -# define local_irq_enable_in_hardirq() local_irq_enable() +# define local_irq_enable_in_hardirq() do { if (hardirq_count() < (MAX_NESTED_INTERRUPTS << HARDIRQ_SHIFT)) local_irq_enable(); } while (0) #endif extern void disable_irq_nosync(unsigned int irq);