Skip to content

Commit

Permalink
init: fix in-place parameter modification regression
Browse files Browse the repository at this point in the history
Before commit 026cee0
("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 <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
Krzysztof Mazur authored and rustyrussell committed Oct 31, 2013
1 parent e0f244c commit 08746a6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ char __initdata boot_command_line[COMMAND_LINE_SIZE];
char *saved_command_line;
/* Command line for parameter parsing */
static char *static_command_line;
/* Command line for per-initcall parameter parsing */
static char *initcall_command_line;

static char *execute_command;
static char *ramdisk_execute_command;
Expand Down Expand Up @@ -347,6 +349,7 @@ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
static void __init setup_command_line(char *command_line)
{
saved_command_line = alloc_bootmem(strlen (boot_command_line)+1);
initcall_command_line = alloc_bootmem(strlen (boot_command_line)+1);
static_command_line = alloc_bootmem(strlen (command_line)+1);
strcpy (saved_command_line, boot_command_line);
strcpy (static_command_line, command_line);
Expand Down Expand Up @@ -744,9 +747,9 @@ static void __init do_initcall_level(int level)
extern const struct kernel_param __start___param[], __stop___param[];
initcall_t *fn;

strcpy(static_command_line, saved_command_line);
strcpy(initcall_command_line, saved_command_line);
parse_args(initcall_level_names[level],
static_command_line, __start___param,
initcall_command_line, __start___param,
__stop___param - __start___param,
level, level,
&repair_env_string);
Expand Down

0 comments on commit 08746a6

Please sign in to comment.