Merge tag 'vfio-ccw-20200206' of https://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / arm / kernel / traps.c
index abb7dd7e656fde025edbb3c88bfee01b7b831759..1e70e7227f0ff2283b07becf1ed543b3482bb280 100644 (file)
@@ -64,14 +64,16 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
 
 void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
 {
+       unsigned long end = frame + 4 + sizeof(struct pt_regs);
+
 #ifdef CONFIG_KALLSYMS
        printk("[<%08lx>] (%ps) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
 #else
        printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
 #endif
 
-       if (in_entry_text(from))
-               dump_mem("", "Exception stack", frame + 4, frame + 4 + sizeof(struct pt_regs));
+       if (in_entry_text(from) && end <= ALIGN(frame, THREAD_SIZE))
+               dump_mem("", "Exception stack", frame + 4, end);
 }
 
 void dump_backtrace_stm(u32 *stack, u32 instruction)