]> git.baikalelectronics.ru Git - kernel.git/commit
efi/x86: Fix boot regression on systems with invalid memmap entries
authorArd Biesheuvel <ardb@kernel.org>
Sat, 1 Feb 2020 23:33:04 +0000 (00:33 +0100)
committerIngo Molnar <mingo@kernel.org>
Sun, 2 Feb 2020 09:25:43 +0000 (10:25 +0100)
commit262d8c4b00e4d2965d432a4148b12de0848c3a87
tree280d1924c791d1dca15902f8a0125b522df453a4
parentbd6322db860c4e964b05d261ac3acece89418dcd
efi/x86: Fix boot regression on systems with invalid memmap entries

In efi_clean_memmap(), we do a pass over the EFI memory map to remove
bogus entries that may be returned on certain systems.

This recent commit:

  a59a68d982858a2e ("efi: Add tracking for dynamically allocated memmaps")

refactored this code to pass the input to efi_memmap_install() via a
temporary struct on the stack, which is populated using an initializer
which inadvertently defines the value of its size field in terms of its
desc_size field, which value cannot be relied upon yet in the initializer
itself.

Fix this by using efi.memmap.desc_size instead, which is where we get
the value for desc_size from in the first place.

Reported-by: Jörg Otte <jrg.otte@gmail.com>
Tested-by: Jörg Otte <jrg.otte@gmail.com>
Tested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: linux-efi@vger.kernel.org
Cc: jrg.otte@gmail.com
Cc: torvalds@linux-foundation.org
Cc: mingo@kernel.org
Link: https://lore.kernel.org/r/20200201233304.18322-1-ardb@kernel.org
arch/x86/platform/efi/efi.c