linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary()
@ 2022-12-02  1:41 Wang Yufen
  2022-12-02  3:14 ` Kees Cook
  2022-12-02  3:19 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Yufen @ 2022-12-02  1:41 UTC (permalink / raw)
  To: viro, ebiederm, keescook; +Cc: linux-fsdevel, linux-mm, Wang Yufen

Fix to return a negative error code from create_elf_fdpic_tables()
instead of 0.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 fs/binfmt_elf_fdpic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 08d0c87..9ce5e1f 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -434,8 +434,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
 	current->mm->start_stack = current->mm->start_brk + stack_size;
 #endif
 
-	if (create_elf_fdpic_tables(bprm, current->mm,
-				    &exec_params, &interp_params) < 0)
+	retval = create_elf_fdpic_tables(bprm, current->mm, &exec_params,
+					 &interp_params);
+	if (retval < 0)
 		goto error;
 
 	kdebug("- start_code  %lx", current->mm->start_code);
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary()
  2022-12-02  1:41 [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary() Wang Yufen
@ 2022-12-02  3:14 ` Kees Cook
  2022-12-02  3:19 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-12-02  3:14 UTC (permalink / raw)
  To: Wang Yufen; +Cc: viro, ebiederm, linux-fsdevel, linux-mm

On Fri, Dec 02, 2022 at 09:41:01AM +0800, Wang Yufen wrote:
> Fix to return a negative error code from create_elf_fdpic_tables()
> instead of 0.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Wang Yufen <wangyufen@huawei.com>

Thanks for the catch! Yeah, it looks like this has been wrong for a long
time. :)

-Kees

> ---
>  fs/binfmt_elf_fdpic.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index 08d0c87..9ce5e1f 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -434,8 +434,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)
>  	current->mm->start_stack = current->mm->start_brk + stack_size;
>  #endif
>  
> -	if (create_elf_fdpic_tables(bprm, current->mm,
> -				    &exec_params, &interp_params) < 0)
> +	retval = create_elf_fdpic_tables(bprm, current->mm, &exec_params,
> +					 &interp_params);
> +	if (retval < 0)
>  		goto error;
>  
>  	kdebug("- start_code  %lx", current->mm->start_code);
> -- 
> 1.8.3.1
> 

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary()
  2022-12-02  1:41 [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary() Wang Yufen
  2022-12-02  3:14 ` Kees Cook
@ 2022-12-02  3:19 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-12-02  3:19 UTC (permalink / raw)
  To: wangyufen, ebiederm, Al Viro; +Cc: Kees Cook, linux-mm, linux-fsdevel

On Fri, 2 Dec 2022 09:41:01 +0800, Wang Yufen wrote:
> Fix to return a negative error code from create_elf_fdpic_tables()
> instead of 0.
> 
> 

Applied to for-next/execve, thanks!

[1/1] binfmt: Fix error return code in load_elf_fdpic_binary()
      https://git.kernel.org/kees/c/e7f703ff2507

-- 
Kees Cook



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-02  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02  1:41 [PATCH] binfmt: Fix error return code in load_elf_fdpic_binary() Wang Yufen
2022-12-02  3:14 ` Kees Cook
2022-12-02  3:19 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox