parisc: Disable further stack checks when panic occurs during stack check
authorHelge Deller <deller@gmx.de>
Sat, 8 Jul 2017 21:25:14 +0000 (23:25 +0200)
committerHelge Deller <deller@gmx.de>
Sun, 23 Jul 2017 18:59:45 +0000 (20:59 +0200)
Before the irq handler detects a low stack and then panics the kernel, disable
further stack checks to avoid recursive panics.

Reported-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/irq.c

index ba5e1c7b1f177d45f743392c0950017622b143a8..5404e4086cb95d5e7a5b49e06e783f0cfdf89b8b 100644 (file)
@@ -413,6 +413,10 @@ static inline void stack_overflow_check(struct pt_regs *regs)
        if (regs->sr[7])
                return;
 
+       /* exit if already in panic */
+       if (sysctl_panic_on_stackoverflow < 0)
+               return;
+
        /* calculate kernel stack usage */
        stack_usage = sp - stack_start;
 #ifdef CONFIG_IRQSTACKS
@@ -454,8 +458,10 @@ check_kernel_stack:
 #ifdef CONFIG_IRQSTACKS
 panic_check:
 #endif
-       if (sysctl_panic_on_stackoverflow)
+       if (sysctl_panic_on_stackoverflow) {
+               sysctl_panic_on_stackoverflow = -1; /* disable further checks */
                panic("low stack detected by irq handler - check messages\n");
+       }
 #endif
 }