powerpc: Fix graceful debugger recovery
authorNicholas Piggin <npiggin@gmail.com>
Tue, 8 Nov 2016 12:14:44 +0000 (23:14 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Nov 2016 11:40:42 +0000 (22:40 +1100)
When exiting xmon with 'x' (exit and recover), oops_begin bails
out immediately, but die then calls __die() and oops_end(), which
cause a lot of bad things to happen.

If the debugger was attached then went to graceful recovery, exit
from die() immediately.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/traps.c

index 91d278c9ab28dc46de13e7a7bb6e0da357dce5e2..13ca8b687e8820410255357e676105725f99d629 100644 (file)
@@ -122,9 +122,6 @@ static unsigned long oops_begin(struct pt_regs *regs)
        int cpu;
        unsigned long flags;
 
-       if (debugger(regs))
-               return 1;
-
        oops_enter();
 
        /* racy, but better than risking deadlock. */
@@ -227,8 +224,12 @@ NOKPROBE_SYMBOL(__die);
 
 void die(const char *str, struct pt_regs *regs, long err)
 {
-       unsigned long flags = oops_begin(regs);
+       unsigned long flags;
+
+       if (debugger(regs))
+               return;
 
+       flags = oops_begin(regs);
        if (__die(str, regs, err))
                err = 0;
        oops_end(flags, regs, err);