summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2021-09-16 08:23:12 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2021-10-11 04:27:40 +0200
commit1ae43851b18afe861120ebd7c426dc44f06bb2bd (patch)
treebeea8a57f22ba8778cd127a446765e0e41692b41 /init
parenttracing: Fix memory leak in eprobe_register() (diff)
downloadlinux-1ae43851b18afe861120ebd7c426dc44f06bb2bd.tar.xz
linux-1ae43851b18afe861120ebd7c426dc44f06bb2bd.zip
bootconfig: init: Fix memblock leak in xbc_make_cmdline()
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>
Diffstat (limited to 'init')
-rw-r--r--init/main.c1
1 files changed, 1 insertions, 0 deletions
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;
}