From patchwork Mon Nov 16 14:06:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 11908603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5D7314B3 for ; Mon, 16 Nov 2020 14:03:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B1B422265 for ; Mon, 16 Nov 2020 14:03:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B1B422265 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3CAA96B005D; Mon, 16 Nov 2020 09:03:21 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 37A376B006C; Mon, 16 Nov 2020 09:03:21 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 290D56B006E; Mon, 16 Nov 2020 09:03:21 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id EFE6B6B005D for ; Mon, 16 Nov 2020 09:03:20 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7FA543628 for ; Mon, 16 Nov 2020 14:03:20 +0000 (UTC) X-FDA: 77490448560.28.shame43_3f0468327329 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 4E2FD6C13 for ; Mon, 16 Nov 2020 14:03:20 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,chengzhihao1@huawei.com,,RULES_HIT:30054:30070:30090,0,RBL:45.249.212.190:@huawei.com:.lbl8.mailshell.net-64.95.201.95 62.18.2.100;04yfef3nqemoq8ohspm4ndr69xqe7ypsra97ji8kdry9duyk3jjxszdc81i8omj.7qtd1fh8mnnpjbfaw4xy3iitnad7rqqz7fw1wmoz6wjor6qz67uorhicftf743u.y-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:69,LUA_SUMMARY:none X-HE-Tag: shame43_3f0468327329 X-Filterd-Recvd-Size: 2124 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 16 Nov 2020 14:03:16 +0000 (UTC) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CZW4C3l4wzkZDy; Mon, 16 Nov 2020 22:02:51 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Mon, 16 Nov 2020 22:03:07 +0800 From: Zhihao Cheng To: CC: , , Subject: [PATCH v2] binfmt_elf_fdpic: return corresponding errcode if create_elf_fdpic_tables() fail Date: Mon, 16 Nov 2020 22:06:44 +0800 Message-ID: <20201116140644.2360816-1-chengzhihao1@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Signed-off-by: Zhihao Cheng --- 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 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);