diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2017-04-26 23:15:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-25 09:44:47 -0400 |
commit | cc0aa21de47c64f7eb557bd41447a9ebe312c0ab (patch) | |
tree | 4af61603122a78170f02aa62590cae42f4c5cfb0 | |
parent | 541c678441980b48d3600d1bda0737219eb81f61 (diff) |
um: Fix to call read_initrd after init_bootmem
commit 5b4236e17cc1bd9fa14b2b0c7a4ae632d41f2e20 upstream.
Since read_initrd() invokes alloc_bootmem() for allocating
memory to load initrd image, it must be called after init_bootmem.
This makes read_initrd() called directly from setup_arch()
after init_bootmem() and mem_total_pages().
Fixes: b63236972e1 ("um: Setup physical memory in setup_arch()")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | arch/um/kernel/initrd.c | 4 | ||||
-rw-r--r-- | arch/um/kernel/um_arch.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/arch/um/kernel/initrd.c b/arch/um/kernel/initrd.c index 48bae81f8dca..6f6e7896e53f 100644 --- a/arch/um/kernel/initrd.c +++ b/arch/um/kernel/initrd.c | |||
@@ -14,7 +14,7 @@ | |||
14 | static char *initrd __initdata = NULL; | 14 | static char *initrd __initdata = NULL; |
15 | static int load_initrd(char *filename, void *buf, int size); | 15 | static int load_initrd(char *filename, void *buf, int size); |
16 | 16 | ||
17 | static int __init read_initrd(void) | 17 | int __init read_initrd(void) |
18 | { | 18 | { |
19 | void *area; | 19 | void *area; |
20 | long long size; | 20 | long long size; |
@@ -46,8 +46,6 @@ static int __init read_initrd(void) | |||
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | 48 | ||
49 | __uml_postsetup(read_initrd); | ||
50 | |||
51 | static int __init uml_initrd_setup(char *line, int *add) | 49 | static int __init uml_initrd_setup(char *line, int *add) |
52 | { | 50 | { |
53 | initrd = line; | 51 | initrd = line; |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index e8175a8aa22c..26b47deca2a0 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -336,11 +336,17 @@ int __init linux_main(int argc, char **argv) | |||
336 | return start_uml(); | 336 | return start_uml(); |
337 | } | 337 | } |
338 | 338 | ||
339 | int __init __weak read_initrd(void) | ||
340 | { | ||
341 | return 0; | ||
342 | } | ||
343 | |||
339 | void __init setup_arch(char **cmdline_p) | 344 | void __init setup_arch(char **cmdline_p) |
340 | { | 345 | { |
341 | stack_protections((unsigned long) &init_thread_info); | 346 | stack_protections((unsigned long) &init_thread_info); |
342 | setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); | 347 | setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); |
343 | mem_total_pages(physmem_size, iomem_size, highmem); | 348 | mem_total_pages(physmem_size, iomem_size, highmem); |
349 | read_initrd(); | ||
344 | 350 | ||
345 | paging_init(); | 351 | paging_init(); |
346 | strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | 352 | strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); |