]> git.baikalelectronics.ru Git - kernel.git/commitdiff
binfmt: Fix error return code in load_elf_fdpic_binary()
authorWang Yufen <wangyufen@huawei.com>
Fri, 2 Dec 2022 01:41:01 +0000 (09:41 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:46 +0000 (11:41 +0100)
[ Upstream commit e7f703ff2507f4e9f496da96cd4b78fd3026120c ]

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

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/1669945261-30271-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/binfmt_elf_fdpic.c

index 9f785627009cab525d46fb05d3d5244e6b9a4f03..39bcbfab386ddf253e123c97356ce65c0eba023c 100644 (file)
@@ -435,8 +435,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);