]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/mips/kernel/traps.c
[MIPS] Fix check for valid stack pointer during backtrace
[karo-tx-linux.git] / arch / mips / kernel / traps.c
index cb8b0e2c79547ba1c67a577cc852daf51f558dab..f9165d1a17bfbccec9d64a9a07148696fcf1784c 100644 (file)
@@ -88,15 +88,17 @@ static void show_raw_backtrace(unsigned long reg29)
 #ifdef CONFIG_KALLSYMS
        printk("\n");
 #endif
-#define IS_KVA01(a) ((((unsigned int)a) & 0xc0000000) == 0x80000000)
-       if (IS_KVA01(sp)) {
-               while (!kstack_end(sp)) {
-                       addr = *sp++;
-                       if (__kernel_text_address(addr))
-                               print_ip_sym(addr);
+       while (!kstack_end(sp)) {
+               unsigned long __user *p =
+                       (unsigned long __user *)(unsigned long)sp++;
+               if (__get_user(addr, p)) {
+                       printk(" (Bad stack address)");
+                       break;
                }
-               printk("\n");
+               if (__kernel_text_address(addr))
+                       print_ip_sym(addr);
        }
+       printk("\n");
 }
 
 #ifdef CONFIG_KALLSYMS