Skip to content

Commit

Permalink
um: Fix to call read_initrd after init_bootmem
Browse files Browse the repository at this point in the history
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().

Cc: <stable@vger.kernel.org>
Fixes: b632369 ("um: Setup physical memory in setup_arch()")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Masami Hiramatsu authored and Richard Weinberger committed May 3, 2017
1 parent 601b7b9 commit 5b4236e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions arch/um/kernel/initrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
static char *initrd __initdata = NULL;
static int load_initrd(char *filename, void *buf, int size);

static int __init read_initrd(void)
int __init read_initrd(void)
{
void *area;
long long size;
Expand Down Expand Up @@ -46,8 +46,6 @@ static int __init read_initrd(void)
return 0;
}

__uml_postsetup(read_initrd);

static int __init uml_initrd_setup(char *line, int *add)
{
initrd = line;
Expand Down
6 changes: 6 additions & 0 deletions arch/um/kernel/um_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,17 @@ int __init linux_main(int argc, char **argv)
return start_uml();
}

int __init __weak read_initrd(void)
{
return 0;
}

void __init setup_arch(char **cmdline_p)
{
stack_protections((unsigned long) &init_thread_info);
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
mem_total_pages(physmem_size, iomem_size, highmem);
read_initrd();

paging_init();
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
Expand Down

0 comments on commit 5b4236e

Please sign in to comment.