From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E762EC433EF for ; Thu, 7 Oct 2021 01:44:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F62C610A8 for ; Thu, 7 Oct 2021 01:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5F62C610A8 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 8F62F6B006C; Wed, 6 Oct 2021 21:44:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A5D3900002; Wed, 6 Oct 2021 21:44:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 794876B0073; Wed, 6 Oct 2021 21:44:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0111.hostedemail.com [216.40.44.111]) by kanga.kvack.org (Postfix) with ESMTP id 699BD6B006C for ; Wed, 6 Oct 2021 21:44:01 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2DA468249980 for ; Thu, 7 Oct 2021 01:44:01 +0000 (UTC) X-FDA: 78667945482.16.6A11F1E Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id B7EC3200B387 for ; Thu, 7 Oct 2021 01:44:00 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EE0D461177; Thu, 7 Oct 2021 01:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633571040; bh=DOUt+G+DupGP6hj17dk+ZbeIgdDhP6gqkJHwLbkCulY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kk9hfy/BKm0v35grJJ97dE3N8yaERLXE4FIsTI1J3gzubuwfe0K7nYL7Mw9D6gg4C UGYZAceQ1tZH3mVGdSb713Je2j/u2iedAll8iHo//5jfrrR1HSzd1tB2TzG4+SO+eN 5UnxpC9ac2K4fvxX3iqJB/emzQX1ZVenvywLN/9tEzTveYSQGNKnnJBsNaeedFd0DF uYftl85Uymnk+Avm9wH/bOelQf7pdpc97OOh8lAWtrnHEY8lp1Txp6q4+KaOc8UYY9 nY2LIu9HgKGck8zMCId7FRxd7UPxPJAumhMCANFYXnC5X25hO350AFrBJJ/1gV/zas dVoqs3cF4jDAw== Date: Thu, 7 Oct 2021 10:43:57 +0900 From: Masami Hiramatsu To: Steven Rostedt Cc: Linus Torvalds , Mike Rapoport , Andrew Morton , LKML , Ingo Molnar , Linux-MM , Vlastimil Babka Subject: Re: [PATCH v4 1/4] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Message-Id: <20211007104357.7b1132f2785858552e53654f@kernel.org> In-Reply-To: <20211006210216.2fdf63cd@rorschach.local.home> References: <163177338366.682366.5998343833719057348.stgit@devnote2> <163177339181.682366.8713781325929549256.stgit@devnote2> <20211006210216.2fdf63cd@rorschach.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B7EC3200B387 X-Stat-Signature: urg1qiorbdgyrjjnxnyazfxsujooarbo Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="kk9hfy/B"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org X-HE-Tag: 1633571040-443176 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: On Wed, 6 Oct 2021 21:02:16 -0400 Steven Rostedt wrote: > On Thu, 16 Sep 2021 15:23:12 +0900 > Masami Hiramatsu wrote: > > > 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; > > } > > > > Hmm, looking at my patch queue, I noticed that this did not get > applied. I'm thinking I may have been confused with the other memory > freeing that was put into the xbc_destroy(), thinking this was part of > that. But now that I look at this patch in the context of the code, it > looks like this patch is required, as "new_cmdline" never gets exposed > on this error. > > Masami, I just want to confirm, that this patch is still relevant, right? Yes, with other 2 patches in this series ([1/4]-[3/4]), I thought you already queued it in your tree as you said in [1]; > I'm going to leave this patch out, and just review and accept the first three patches > in the series. [1] https://lore.kernel.org/all/20210916164805.32592423@gandalf.local.home/T/#u So, my next cleanup series [2] (including xbc_destroy_all() -> xbc_exit()) was based on the [1]'s first 3 patches. [2] https://lore.kernel.org/all/163187294400.2366983.7393164788107844569.stgit@devnote2/T/#u If it helps, I can make these series to one series and rebase on top of your for-next (or ftrace/core) branch. Thank you, > > Thanks! > > -- Steve -- Masami Hiramatsu