Skip to content

Commit 1ae4385

Browse files
mhiramatrostedt
authored andcommitted
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: 51887d0 ("bootconfig: init: Allow admin to use bootconfig for kernel command line") Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 6675880 commit 1ae4385

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

init/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(const char *key)
382382
ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
383383
if (ret < 0 || ret > len) {
384384
pr_err("Failed to print extra kernel cmdline.\n");
385+
memblock_free_ptr(new_cmdline, len + 1);
385386
return NULL;
386387
}
387388

0 commit comments

Comments
 (0)