aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-12-06 23:36:35 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:33 -0500
commit841d5fb7c75260f76ae682648b28a3dca724940d (patch)
tree126dd9c646f384674c2cb99080c980fad209278b /fs/binfmt_elf.c
parentfec1d0115240593b39898289e6e1413ea6e44a84 (diff)
[PATCH] binfmt: fix uaccess handling
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b2efbaead6c3..68e20d5bfe1b 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -243,8 +243,9 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
243 if (interp_aout) { 243 if (interp_aout) {
244 argv = sp + 2; 244 argv = sp + 2;
245 envp = argv + argc + 1; 245 envp = argv + argc + 1;
246 __put_user((elf_addr_t)(unsigned long)argv, sp++); 246 if (__put_user((elf_addr_t)(unsigned long)argv, sp++) ||
247 __put_user((elf_addr_t)(unsigned long)envp, sp++); 247 __put_user((elf_addr_t)(unsigned long)envp, sp++))
248 return -EFAULT;
248 } else { 249 } else {
249 argv = sp; 250 argv = sp;
250 envp = argv + argc + 1; 251 envp = argv + argc + 1;
@@ -254,7 +255,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
254 p = current->mm->arg_end = current->mm->arg_start; 255 p = current->mm->arg_end = current->mm->arg_start;
255 while (argc-- > 0) { 256 while (argc-- > 0) {
256 size_t len; 257 size_t len;
257 __put_user((elf_addr_t)p, argv++); 258 if (__put_user((elf_addr_t)p, argv++))
259 return -EFAULT;
258 len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES); 260 len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
259 if (!len || len > PAGE_SIZE*MAX_ARG_PAGES) 261 if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
260 return 0; 262 return 0;
@@ -265,7 +267,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
265 current->mm->arg_end = current->mm->env_start = p; 267 current->mm->arg_end = current->mm->env_start = p;
266 while (envc-- > 0) { 268 while (envc-- > 0) {
267 size_t len; 269 size_t len;
268 __put_user((elf_addr_t)p, envp++); 270 if (__put_user((elf_addr_t)p, envp++))
271 return -EFAULT;
269 len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES); 272 len = strnlen_user((void __user *)p, PAGE_SIZE*MAX_ARG_PAGES);
270 if (!len || len > PAGE_SIZE*MAX_ARG_PAGES) 273 if (!len || len > PAGE_SIZE*MAX_ARG_PAGES)
271 return 0; 274 return 0;