mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-05 14:17:43 +00:00
efi/x86: Don't blow away existing initrd
Commit987053a300
("efi/x86: Move command-line initrd loading to efi_main") moved the command-line initrd loading into efi_main(), with a check to ensure that it was attempted only if the EFI stub was booted via efi_pe_entry rather than the EFI handover entry. However, in the case where it was booted via handover entry, and thus an initrd may have already been loaded by the bootloader, it then wrote 0 for the initrd address and size, removing any existing initrd. Fix this by checking if size is positive before setting the fields in the bootparams structure. Fixes:987053a300
("efi/x86: Move command-line initrd loading to efi_main") Reported-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Dan Williams <dan.j.williams@intel.com> Link: https://lkml.kernel.org/r/20200527232602.21596-1-nivedita@alum.mit.edu
This commit is contained in:
parent
d1343da330
commit
e9524fb97a
1 changed files with 6 additions and 4 deletions
|
@ -768,10 +768,12 @@ unsigned long efi_main(efi_handle_t handle,
|
|||
efi_err("Failed to load initrd!\n");
|
||||
goto fail;
|
||||
}
|
||||
efi_set_u64_split(addr, &hdr->ramdisk_image,
|
||||
&boot_params->ext_ramdisk_image);
|
||||
efi_set_u64_split(size, &hdr->ramdisk_size,
|
||||
&boot_params->ext_ramdisk_size);
|
||||
if (size > 0) {
|
||||
efi_set_u64_split(addr, &hdr->ramdisk_image,
|
||||
&boot_params->ext_ramdisk_image);
|
||||
efi_set_u64_split(size, &hdr->ramdisk_size,
|
||||
&boot_params->ext_ramdisk_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue