From patchwork Thu Sep 16 06:23:12 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: 12498125 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 C6A96C433EF for ; Thu, 16 Sep 2021 06:23:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 60D6A61207 for ; Thu, 16 Sep 2021 06:23:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 60D6A61207 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 0981F940008; Thu, 16 Sep 2021 02:23:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0486A6B0072; Thu, 16 Sep 2021 02:23:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E7A53940008; Thu, 16 Sep 2021 02:23:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id DA0806B0071 for ; Thu, 16 Sep 2021 02:23:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 950992D4A9 for ; Thu, 16 Sep 2021 06:23:15 +0000 (UTC) X-FDA: 78592444350.28.A04C94C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id 563D250000B3 for ; Thu, 16 Sep 2021 06:23:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5279E611CA; Thu, 16 Sep 2021 06:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631773394; bh=tjYE+w+hVKFuNE7M94ifyu2S6XUIpnaX8UMLFXe0coU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwxvbaDFsFzJ0WbuMDAhQxGz/QZ32erbRaFMpTAonzvMiZydGTsKs5oL/JGb9gB++ 2efsqfpYklFXhsEVzQICxeLwaa4R3VpphL14ekzIMTZKs/ezdJpXfKXfLlcseRl8iT JmAz4N8KNBdOVH4rKiOxW/uBGcJSftOWd8VxjMw9AoLegyAXJIdnjId1BNSWX9o4M4 /AbiAetqvRmUo+R8Jp8hOjqk/OT6h1HXiWyz3yLXEa7hFPdF70Q/DxAUAnLptJe8r+ f8ZuVJIkt7JqYBUju9hvSti6nQgzROJ1saFL8n+Pi+WnWOaf1lmNMi/zan62sqvRXd JV1cA2GLd6biQ== From: Masami Hiramatsu To: Steven Rostedt Cc: Linus Torvalds , Mike Rapoport , Andrew Morton , LKML , Ingo Molnar , Masami Hiramatsu , Linux-MM , Vlastimil Babka Subject: [PATCH v4 1/4] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Date: Thu, 16 Sep 2021 15:23:12 +0900 Message-Id: <163177339181.682366.8713781325929549256.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163177338366.682366.5998343833719057348.stgit@devnote2> References: <163177338366.682366.5998343833719057348.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 563D250000B3 X-Stat-Signature: b6mry9m4sr64738scd51rsoknr49hums Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MwxvbaDF; spf=pass (imf04.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-HE-Tag: 1631773395-674794 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 xbc_make_cmdline(). Fixes: 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line") 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 3f7216934441..0b054fff8e92 100644 --- a/init/main.c +++ b/init/main.c @@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(const char *key) ret = xbc_snprint_cmdline(new_cmdline, len + 1, root); if (ret < 0 || ret > len) { pr_err("Failed to print extra kernel cmdline.\n"); + memblock_free_ptr(new_cmdline, len + 1); return NULL; }