Skip to content

Commit f27060e

Browse files
mhiramatgregkh
authored andcommitted
bootconfig: init: Fix memblock leak in xbc_make_cmdline()
commit 1ae4385 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: 51887d0 ("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>
1 parent 04e4651 commit f27060e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

init/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ static char * __init xbc_make_cmdline(const char *key)
380380
ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
381381
if (ret < 0 || ret > len) {
382382
pr_err("Failed to print extra kernel cmdline.\n");
383+
memblock_free(__pa(new_cmdline), len + 1);
383384
return NULL;
384385
}
385386

0 commit comments

Comments
 (0)