提交 23c4971e 编写于 作者: W WANG Cong 提交者: Al Viro

[Patch] fs/binfmt_elf.c: fix wrong return values

create_elf_tables() returns 0 on success. But when strnlen_user() "fails",
it returns 0 directly. So this is wrong.
Signed-off-by: NWANG Cong <wangcong@zeuux.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 08a6fac1
...@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, ...@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
return -EFAULT; return -EFAULT;
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
if (!len || len > MAX_ARG_STRLEN) if (!len || len > MAX_ARG_STRLEN)
return 0; return -EINVAL;
p += len; p += len;
} }
if (__put_user(0, argv)) if (__put_user(0, argv))
...@@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, ...@@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
return -EFAULT; return -EFAULT;
len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); len = strnlen_user((void __user *)p, MAX_ARG_STRLEN);
if (!len || len > MAX_ARG_STRLEN) if (!len || len > MAX_ARG_STRLEN)
return 0; return -EINVAL;
p += len; p += len;
} }
if (__put_user(0, envp)) if (__put_user(0, envp))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册