summaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/traps.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-12-15 22:47:47 -0700
committerKyle McMartin <kyle@athena.road.mcmartin.ca>2007-02-17 00:51:25 -0500
commit9f15c82686251cd2b97ac6859de62959d3c4afe1 (patch)
tree6bacc1d1422fd9770d9b5f90417a804a8cad7ef1 /arch/parisc/kernel/traps.c
parente6fc0449be45a0e7520da6a17a64520743b9aa20 (diff)
downloadop-kernel-dev-9f15c82686251cd2b97ac6859de62959d3c4afe1.zip
op-kernel-dev-9f15c82686251cd2b97ac6859de62959d3c4afe1.tar.gz
[PARISC] Fix show_stack() when we can't kmalloc
show_stack() was calling kzalloc() to allocate a struct pt_regs. This meant that *really* early stack dumps would cause a null pointer dereference. x86_64 allocates its pt_regs on the stack, so do the same. Kyle actually committed this exact patch to CVS on Wed Jul 26 14:32:39 2006 UTC, and never moved it across to git. Bad Kyle. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/kernel/traps.c')
-rw-r--r--arch/parisc/kernel/traps.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index fa08112..9497225 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -187,18 +187,19 @@ void show_stack(struct task_struct *task, unsigned long *s)
if (!task) {
unsigned long sp;
- struct pt_regs *r;
HERE:
asm volatile ("copy %%r30, %0" : "=r"(sp));
- r = kzalloc(sizeof(struct pt_regs), GFP_KERNEL);
- if (!r)
- return;
- r->iaoq[0] = (unsigned long)&&HERE;
- r->gr[2] = (unsigned long)__builtin_return_address(0);
- r->gr[30] = sp;
- unwind_frame_init(&info, current, r);
- kfree(r);
+ {
+ struct pt_regs r;
+
+ memset(&r, 0, sizeof(struct pt_regs));
+ r.iaoq[0] = (unsigned long)&&HERE;
+ r.gr[2] = (unsigned long)__builtin_return_address(0);
+ r.gr[30] = sp;
+
+ unwind_frame_init(&info, current, &r);
+ }
} else {
unwind_frame_init_from_blocked_task(&info, task);
}
OpenPOWER on IntegriCloud