Commit 5ff5980e authored by Wang Yufen's avatar Wang Yufen Committed by zhaoxiaoqiang11
Browse files

binfmt: Fix error return code in load_elf_fdpic_binary()

stable inclusion
from stable-v5.10.163
commit c3e8bbcbaa87d15ffc179abc0dcabb1e94f4757e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7PJ9N

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c3e8bbcbaa87d15ffc179abc0dcabb1e94f4757e



----------------------------------------------------

commit e7f703ff upstream.

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

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarWang Yufen <wangyufen@huawei.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/1669945261-30271-1-git-send-email-wangyufen@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarzhaoxiaoqiang11 <zhaoxiaoqiang11@jd.com>
parent 0fd431ab
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);