diff mbox series

[v3,2/3] bootconfig: init: Fix memblock leak in setup_boot_config()

Message ID 163171198422.590070.5414135296244084523.stgit@devnote2 (mailing list archive)
State New
Headers show
Series bootconfig: Fixes to bootconfig memory management | expand

Commit Message

Masami Hiramatsu (Google) Sept. 15, 2021, 1:19 p.m. UTC
Free unused memblock in a error case to fix memblock leak
in setup_boot_config().

Fixes: 7684b8582c24 ("bootconfig: Load boot config from the tail of initrd")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 init/main.c |    1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/init/main.c b/init/main.c
index 0b054fff8e92..4f059fde1df0 100644
--- a/init/main.c
+++ b/init/main.c
@@ -459,6 +459,7 @@  static void __init setup_boot_config(void)
 		else
 			pr_err("Failed to parse bootconfig: %s at %d.\n",
 				msg, pos);
+		memblock_free_ptr(copy, size + 1);
 	} else {
 		pr_info("Load bootconfig: %d bytes %d nodes\n", size, ret);
 		/* keys starting with "kernel." are passed via cmdline */