diff mbox series

[v2] binfmt_elf_fdpic: return corresponding errcode if create_elf_fdpic_tables() fail

Message ID 20201116140644.2360816-1-chengzhihao1@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] binfmt_elf_fdpic: return corresponding errcode if create_elf_fdpic_tables() fail | expand

Commit Message

Zhihao Cheng Nov. 16, 2020, 2:06 p.m. UTC
Function load_elf_fdpic_binary() may return 0 to caller if
create_elf_fdpic_tables() fail, which will misslead caller
to continue running without handling errors.

Fixes: 1da177e4c3f41524e886 ("Linux-2.6.12-rc2")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 fs/binfmt_elf_fdpic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index be4062b8ba75..6243abf3f8f3 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);