Commit 65c0ff40 authored by Hugh Dickins's avatar Hugh Dickins Committed by Ingo Molnar

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: default avatarHugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20120323225648.15DD5A033B@akpm.mtv.corp.google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4da7072a
...@@ -37,13 +37,16 @@ print_ftrace_graph_addr(unsigned long addr, void *data, ...@@ -37,13 +37,16 @@ print_ftrace_graph_addr(unsigned long addr, void *data,
const struct stacktrace_ops *ops, const struct stacktrace_ops *ops,
struct thread_info *tinfo, int *graph) struct thread_info *tinfo, int *graph)
{ {
struct task_struct *task = tinfo->task; struct task_struct *task;
unsigned long ret_addr; unsigned long ret_addr;
int index = task->curr_ret_stack; int index;
if (addr != (unsigned long)return_to_handler) if (addr != (unsigned long)return_to_handler)
return; return;
task = tinfo->task;
index = task->curr_ret_stack;
if (!task->ret_stack || index < *graph) if (!task->ret_stack || index < *graph)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment