aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorHideo Saito <saito@densan.co.jp>2007-02-28 04:35:42 -0500
committerPaul Mundt <lethal@linux-sh.org>2007-03-05 00:13:26 -0500
commite6bcf562e58662b9765748d346e4c076b20e3aa5 (patch)
tree0c8982c11cd410f4b654b8fda9a1a1fc6776e4a3 /arch/sh
parente523d93c8487667552dd29ff756d6ea6bce30851 (diff)
sh: Fix kernel thread stack corruption with preempt.
When I run a preemptive kernel-2.6.20 for SH7780, a created kthread(pdflush) can not exit by do_exit() in kernel_thread_helper. I think that the created kthread should have a room for 'struct pt_regs' space on the stack top, because __switch_to() will refer to the space as follows using 'regs = task_pt_regs(prev)' and next condition may be true. Signed-off-by: Hideo Saito <saito@densan.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/process.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 9d6a438b3eaf..e7607366ac4e 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -250,12 +250,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
250 childregs->regs[15] = usp; 250 childregs->regs[15] = usp;
251 ti->addr_limit = USER_DS; 251 ti->addr_limit = USER_DS;
252 } else { 252 } else {
253 childregs->regs[15] = (unsigned long)task_stack_page(p) + 253 childregs->regs[15] = (unsigned long)childregs;
254 THREAD_SIZE;
255 ti->addr_limit = KERNEL_DS; 254 ti->addr_limit = KERNEL_DS;
256 } 255 }
257 256
258 if (clone_flags & CLONE_SETTLS) 257 if (clone_flags & CLONE_SETTLS)
259 childregs->gbr = childregs->regs[0]; 258 childregs->gbr = childregs->regs[0];
260 259
261 childregs->regs[0] = 0; /* Set return value for child */ 260 childregs->regs[0] = 0; /* Set return value for child */