linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Mike Rapoport <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>, Linux-MM <linux-mm@kvack.org>,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v4 1/4] bootconfig: init: Fix memblock leak in xbc_make_cmdline()
Date: Thu, 7 Oct 2021 10:43:57 +0900	[thread overview]
Message-ID: <20211007104357.7b1132f2785858552e53654f@kernel.org> (raw)
In-Reply-To: <20211006210216.2fdf63cd@rorschach.local.home>

On Wed, 6 Oct 2021 21:02:16 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu, 16 Sep 2021 15:23:12 +0900
> Masami Hiramatsu <mhiramat@kernel.org> 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 <mhiramat@kernel.org>
> > ---
> >  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 <mhiramat@kernel.org>

  reply	other threads:[~2021-10-07  1:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  6:23 [PATCH v4 0/4] bootconfig: Fixes to bootconfig memory management etc Masami Hiramatsu
2021-09-16  6:23 ` [PATCH v4 1/4] bootconfig: init: Fix memblock leak in xbc_make_cmdline() Masami Hiramatsu
2021-10-07  1:02   ` Steven Rostedt
2021-10-07  1:43     ` Masami Hiramatsu [this message]
2021-10-07  1:49       ` Steven Rostedt
2021-09-16  6:23 ` [PATCH v4 2/4] bootconfig: Allocate xbc_data inside xbc_init() Masami Hiramatsu
2021-09-16  6:23 ` [PATCH v4 3/4] bootconfig: Add xbc_get_info() for the node information Masami Hiramatsu
2021-09-16  6:23 ` [PATCH v4 4/4] bootconfig: Rename xbc_destroy_all() to xbc_fini() Masami Hiramatsu
2021-09-16 13:26   ` Steven Rostedt
2021-09-16 20:16     ` Linus Torvalds
2021-09-16 20:48       ` Steven Rostedt
2021-09-16 23:20         ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211007104357.7b1132f2785858552e53654f@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).