aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 04:07:07 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 04:07:07 -0400
commit2991be725260d6fec11691a6138b9d71de949956 (patch)
tree407241b126eed902bacba4e02043930c6ce087b4 /arch/sh
parent0f08f338083cc1d68788ccbccc44bd0502fc57ae (diff)
sh: Fixup __strnlen_user() behaviour.
Drop TIF_USERSPACE and add addr_limit to the thread_info struct. Subsequently, use that for address checking in strnlen_user() to ward off bogus -EFAULTs. Make __strnlen_user() return 0 on exception, rather than -EFAULT. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index f2031314cb2b..4a32550fd7c6 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -263,6 +263,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
263 unsigned long unused, 263 unsigned long unused,
264 struct task_struct *p, struct pt_regs *regs) 264 struct task_struct *p, struct pt_regs *regs)
265{ 265{
266 struct thread_info *ti = task_thread_info(p);
266 struct pt_regs *childregs; 267 struct pt_regs *childregs;
267#if defined(CONFIG_SH_FPU) 268#if defined(CONFIG_SH_FPU)
268 struct task_struct *tsk = current; 269 struct task_struct *tsk = current;
@@ -277,8 +278,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
277 278
278 if (user_mode(regs)) { 279 if (user_mode(regs)) {
279 childregs->regs[15] = usp; 280 childregs->regs[15] = usp;
281 ti->addr_limit = USER_DS;
280 } else { 282 } else {
281 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; 283 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
284 ti->addr_limit = KERNEL_DS;
282 } 285 }
283 if (clone_flags & CLONE_SETTLS) { 286 if (clone_flags & CLONE_SETTLS) {
284 childregs->gbr = childregs->regs[0]; 287 childregs->gbr = childregs->regs[0];