From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [for-linus][PATCH 3/7] bootconfig: init: Fix memblock leak in xbc_make_cmdline()
Date: Fri, 15 Oct 2021 23:02:25 -0400 [thread overview]
Message-ID: <20211016030252.289632776@goodmis.org> (raw)
In-Reply-To: 20211016030222.926060517@goodmis.org
From: Masami Hiramatsu <mhiramat@kernel.org>
Free unused memblock in a error case to fix memblock leak
in xbc_make_cmdline().
Link: https://lkml.kernel.org/r/163177339181.682366.8713781325929549256.stgit@devnote2
Fixes: 51887d03aca1 ("bootconfig: init: Allow admin to use bootconfig for kernel command line")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
init/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/init/main.c b/init/main.c
index 81a79a77db46..3c4054a95545 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;
}
--
2.32.0
next prev parent reply other threads:[~2021-10-16 3:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 3:02 [for-linus][PATCH 0/7] tracing: Fixes for 5.15 Steven Rostedt
2021-10-16 3:02 ` [for-linus][PATCH 2/7] tracing: Fix memory leak in eprobe_register() Steven Rostedt
2021-10-16 3:02 ` Steven Rostedt [this message]
2021-10-16 3:02 ` [for-linus][PATCH 4/7] tracing: Fix missing * in comment block Steven Rostedt
2021-10-16 3:02 ` [for-linus][PATCH 5/7] tracing: Fix event probe removal from dynamic events Steven Rostedt
2021-10-16 3:02 ` [for-linus][PATCH 6/7] selftests/ftrace: Update test for more eprobe removal process Steven Rostedt
2021-10-16 3:02 ` [for-linus][PATCH 7/7] nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^ Steven Rostedt
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=20211016030252.289632776@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
/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