From patchwork Wed Sep 15 00:53:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12495209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A9ABC433EF for ; Wed, 15 Sep 2021 00:53:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC66A61165 for ; Wed, 15 Sep 2021 00:53:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BC66A61165 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 5ED51940007; Tue, 14 Sep 2021 20:53:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5998F6B0074; Tue, 14 Sep 2021 20:53:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4882B940007; Tue, 14 Sep 2021 20:53:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 3C2416B0073 for ; Tue, 14 Sep 2021 20:53:26 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id F13E03A7C1 for ; Wed, 15 Sep 2021 00:53:25 +0000 (UTC) X-FDA: 78587984370.30.E9AE12B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf24.hostedemail.com (Postfix) with ESMTP id B4072B0000A0 for ; Wed, 15 Sep 2021 00:53:25 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D4326103B; Wed, 15 Sep 2021 00:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631667205; bh=3BaNmCZTv0c11pAEto4TWOw5JJNkPY3QPpJT3D6yH7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g86IkxSDnxmpvSl4SA0OUao7b8oHAidoBLVipURaY0Z4Rd7VYJtOr1qJL/mdzZs9y /AccSRLvdl+E/Kjge7FrrCJll/UKEcW9GfeZuS1pkNuZdhea/mOziyPTxO/PeWhPJS mW3PdRm+YqY4myc6V99F0gc1LDCrlqXf5uuH/JR9JLaTT4JGFzHzMutlxz7nLhsGVj mi0zeUChV8oLVCXg5WlWhvmQxhDsjOsHqy5K4v959knj2NG1mypYAreuLjT0WlnpYG Z1OH0Egy9hFqR1E0xUoyVMg1JWbg4Tz1aLA8r8+21cgTk22fy9V1J3jjKTrKhhoyeE eWDzRRdceiyVg== From: Masami Hiramatsu To: Steven Rostedt Cc: Linus Torvalds , Mike Rapoport , Andrew Morton , LKML , Ingo Molnar , Masami Hiramatsu , Linux-MM , Vlastimil Babka Subject: [PATCH v2 3/5] bootconfig: init: Fix memblock leak in setup_boot_config() Date: Wed, 15 Sep 2021 09:53:21 +0900 Message-Id: <163166720179.510331.2971582309563797048.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163166717752.510331.12843735095061762373.stgit@devnote2> References: <163166717752.510331.12843735095061762373.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=g86IkxSD; spf=pass (imf24.hostedemail.com: domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: apsrd4ooukip5nanup36n13hhr65owqw X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B4072B0000A0 X-HE-Tag: 1631667205-551421 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: Free unused memblock in a error case to fix memblock leak in setup_boot_config(). Fixes: 7684b8582c24 ("bootconfig: Load boot config from the tail of initrd") Signed-off-by: Masami Hiramatsu --- init/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/init/main.c b/init/main.c index 0b054fff8e92..4f059fde1df0 100644 --- a/init/main.c +++ b/init/main.c @@ -459,6 +459,7 @@ static void __init setup_boot_config(void) else pr_err("Failed to parse bootconfig: %s at %d.\n", msg, pos); + memblock_free_ptr(copy, size + 1); } else { pr_info("Load bootconfig: %d bytes %d nodes\n", size, ret); /* keys starting with "kernel." are passed via cmdline */