Commit c7766898 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix show_task oops

Patch from Russell King <rmk@arm.linux.org.uk>

show_task() attempts to calculate the amount of free space which hasn't been
written to on the kernel stack by reading from the base of the kernel stack
upwards.

However, it mistakenly uses the task_struct pointer as the base of the stack,
which it isn't, and this can cause an oops.

Here is a patch which uses the task thread pointer instead, which should be
located at the bottom of the kernel stack.  It appears this was missed when
the thread structure was introduced.
parent 2e7c21ea
...@@ -2057,7 +2057,7 @@ static void show_task(task_t * p) ...@@ -2057,7 +2057,7 @@ static void show_task(task_t * p)
printk(" %016lx ", thread_saved_pc(p)); printk(" %016lx ", thread_saved_pc(p));
#endif #endif
{ {
unsigned long * n = (unsigned long *) (p+1); unsigned long * n = (unsigned long *) (p->thread_info+1);
while (!*n) while (!*n)
n++; n++;
free = (unsigned long) n - (unsigned long)(p+1); free = (unsigned long) n - (unsigned long)(p+1);
......
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