diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 17:07:07 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 17:07:07 +0900 |
commit | 2991be725260d6fec11691a6138b9d71de949956 (patch) | |
tree | 407241b126eed902bacba4e02043930c6ce087b4 /arch/sh/kernel/process.c | |
parent | 0f08f338083cc1d68788ccbccc44bd0502fc57ae (diff) | |
download | talos-obmc-linux-2991be725260d6fec11691a6138b9d71de949956.tar.gz talos-obmc-linux-2991be725260d6fec11691a6138b9d71de949956.zip |
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/kernel/process.c')
-rw-r--r-- | arch/sh/kernel/process.c | 3 |
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, unsigned long unused, struct task_struct *p, struct pt_regs *regs) { + struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs; #if defined(CONFIG_SH_FPU) struct task_struct *tsk = current; @@ -277,8 +278,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, if (user_mode(regs)) { childregs->regs[15] = usp; + ti->addr_limit = USER_DS; } else { childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; + ti->addr_limit = KERNEL_DS; } if (clone_flags & CLONE_SETTLS) { childregs->gbr = childregs->regs[0]; |