From: Hugh Dickins Date: Fri, 23 Mar 2012 21:02:55 +0000 (-0700) Subject: x86: Stop recursive fault in print_context_stack after stack overflow X-Git-Tag: upstream/snapshot3+hdmi~7709^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65c0ff4079c011232e795e62c74a0a95512b7ac3;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git x86: Stop recursive fault in print_context_stack after stack overflow After printing out the first line of a stack backtrace, print_context_stack() calls print_ftrace_graph_addr() to check if it's making a graph of function calls, usually not the case. But unfortunate ordering of assignments causes this to oops if an earlier stack overflow corrupted threadinfo->task. Reorder to avoid that irritation. ( The fact that there was a stack overflow may often be more interesting than the stack that can now be shown; but integrating that information with this stacktrace is awkward, so leave it to overflow reporting. ) Signed-off-by: Hugh Dickins Signed-off-by: Andrew Morton Cc: Namhyung Kim Cc: Frederic Weisbecker Link: http://lkml.kernel.org/r/20120323225648.15DD5A033B@akpm.mtv.corp.google.com Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 4025fe4..90bf130 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -37,13 +37,16 @@ print_ftrace_graph_addr(unsigned long addr, void *data, const struct stacktrace_ops *ops, struct thread_info *tinfo, int *graph) { - struct task_struct *task = tinfo->task; + struct task_struct *task; unsigned long ret_addr; - int index = task->curr_ret_stack; + int index; if (addr != (unsigned long)return_to_handler) return; + task = tinfo->task; + index = task->curr_ret_stack; + if (!task->ret_stack || index < *graph) return;