summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2021-09-16 15:23:12 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-21 13:46:35 +0100
commitf27060e28efcbd939e4ae6cd2ecc2ba7d2f5d93d (patch)
tree6c4fbbcd4f61bb575a55508acad01926e1ee6dd6 /init
parent04e46514fef692ccd0bca6fbab7fa1e63e5cd05a (diff)
bootconfig: init: Fix memblock leak in xbc_make_cmdline()
commit 1ae43851b18afe861120ebd7c426dc44f06bb2bd upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 dd26a42e80a8..4fe58ed4aca7 100644
--- a/init/main.c
+++ b/init/main.c
@@ -380,6 +380,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(__pa(new_cmdline), len + 1);
return NULL;
}