Skip to content
Commit e9524fb9 authored by Arvind Sankar's avatar Arvind Sankar Committed by Borislav Petkov
Browse files

efi/x86: Don't blow away existing initrd



Commit

  987053a3 ("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: 987053a3 ("efi/x86: Move command-line initrd loading to efi_main")
Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Reviewed-by: default avatarArd Biesheuvel <ardb@kernel.org>
Tested-by: default avatarDan Williams <dan.j.williams@intel.com>
Link: https://lkml.kernel.org/r/20200527232602.21596-1-nivedita@alum.mit.edu
parent d1343da3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment