Skip to content

Commit 40caa12

Browse files
mhiramatrostedt
authored andcommitted
init: bootconfig: Remove all bootconfig data when the init memory is removed
Since the bootconfig is used only in the init functions, it doesn't need to keep the data after boot. Free it when the init memory is removed. Link: https://lkml.kernel.org/r/163077084958.222577.5924961258513004428.stgit@devnote2 Signed-off-by: Masami Hiramatsu <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 4b6b08f commit 40caa12

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

init/main.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,12 @@ static void __init setup_boot_config(void)
468468
return;
469469
}
470470

471-
#else
471+
static void __init exit_boot_config(void)
472+
{
473+
xbc_destroy_all();
474+
}
475+
476+
#else /* !CONFIG_BOOT_CONFIG */
472477

473478
static void __init setup_boot_config(void)
474479
{
@@ -481,7 +486,11 @@ static int __init warn_bootconfig(char *str)
481486
pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
482487
return 0;
483488
}
484-
#endif
489+
490+
#define exit_boot_config() do {} while (0)
491+
492+
#endif /* CONFIG_BOOT_CONFIG */
493+
485494
early_param("bootconfig", warn_bootconfig);
486495

487496
/* Change NUL term back to "=", to make "param" the whole string. */
@@ -1493,6 +1502,7 @@ static int __ref kernel_init(void *unused)
14931502
kprobe_free_init_mem();
14941503
ftrace_free_init_mem();
14951504
kgdb_free_init_mem();
1505+
exit_boot_config();
14961506
free_initmem();
14971507
mark_readonly();
14981508

0 commit comments

Comments
 (0)