kdb: Fix early debugging crash regression
authorJason Wessel <jason.wessel@windriver.com>
Fri, 29 Oct 2010 18:14:41 +0000 (13:14 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Fri, 29 Oct 2010 18:14:41 +0000 (13:14 -0500)
The kdb_current legally be equal to NULL in the early boot of the x86
arch.  The problem pcan be observed by booting with the kernel arguments:

    earlyprintk=vga ekgdboc=kbd kgdbwait

The kdb shell will oops on entry and recursively fault because it
cannot get past the final stage of shell initialization.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kernel/debug/kdb/kdb_main.c

index 9755ac05e446ebc816eb8064ef54d161df9d180d..37755d621924e5256b3494d5e94b57415be5a3f1 100644 (file)
@@ -1127,7 +1127,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
                /* special case below */
        } else {
                kdb_printf("\nEntering kdb (current=0x%p, pid %d) ",
-                          kdb_current, kdb_current->pid);
+                          kdb_current, kdb_current ? kdb_current->pid : 0);
 #if defined(CONFIG_SMP)
                kdb_printf("on processor %d ", raw_smp_processor_id());
 #endif