aboutsummaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorKrzysztof Mazur <krzysiek@podlesie.net>2013-10-30 23:15:39 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-10-30 23:19:13 -0400
commit08746a65c2961b5765a66350823ff75ace63bfd1 (patch)
tree2f21949617bb303be3333f7163ee151d0d95c28d /init/main.c
parente0f244c63fc9d192dfd399cc2677bbdca61994b1 (diff)
init: fix in-place parameter modification regression
Before commit 026cee0086fe1df4cf74691cf273062cc769617d ("params: <level>_initcall-like kernel parameters") the __setup parameter parsing code could modify parameter in the static_command_line buffer and such modifications were kept. After that commit such modifications are destroyed during per-initcall level parameter parsing because the same static_command_line buffer is used and only parameters for appropriate initcall level are parsed. That change broke at least parsing "ubd" parameter in the ubd driver when the COW file is used. Now the separate buffer is used for per-initcall parameter parsing. Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index af310afbef28..1300a0dd3207 100644
--- a/init/main.c
+++ b/init/main.c
@@ -131,6 +131,8 @@ char __initdata boot_command_line[COMMAND_LINE_SIZE];
131char *saved_command_line; 131char *saved_command_line;
132/* Command line for parameter parsing */ 132/* Command line for parameter parsing */
133static char *static_command_line; 133static char *static_command_line;
134/* Command line for per-initcall parameter parsing */
135static char *initcall_command_line;
134 136
135static char *execute_command; 137static char *execute_command;
136static char *ramdisk_execute_command; 138static char *ramdisk_execute_command;
@@ -347,6 +349,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
347static void __init setup_command_line(char *command_line) 349static void __init setup_command_line(char *command_line)
348{ 350{
349 saved_command_line = alloc_bootmem(strlen (boot_command_line)+1); 351 saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
352 initcall_command_line = alloc_bootmem(strlen (boot_command_line)+1);
350 static_command_line = alloc_bootmem(strlen (command_line)+1); 353 static_command_line = alloc_bootmem(strlen (command_line)+1);
351 strcpy (saved_command_line, boot_command_line); 354 strcpy (saved_command_line, boot_command_line);
352 strcpy (static_command_line, command_line); 355 strcpy (static_command_line, command_line);
@@ -744,9 +747,9 @@ static void __init do_initcall_level(int level)
744 extern const struct kernel_param __start___param[], __stop___param[]; 747 extern const struct kernel_param __start___param[], __stop___param[];
745 initcall_t *fn; 748 initcall_t *fn;
746 749
747 strcpy(static_command_line, saved_command_line); 750 strcpy(initcall_command_line, saved_command_line);
748 parse_args(initcall_level_names[level], 751 parse_args(initcall_level_names[level],
749 static_command_line, __start___param, 752 initcall_command_line, __start___param,
750 __stop___param - __start___param, 753 __stop___param - __start___param,
751 level, level, 754 level, level,
752 &repair_env_string); 755 &repair_env_string);