From: Oleksandr Tymoshenko Date: Sat, 23 Mar 2024 06:33:33 +0000 (+0000) Subject: efi: fix panic in kdump kernel X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=62b71cd73d41ddac6b1760402bbe8c4932e23531;p=people%2Faperard%2Flinux.git efi: fix panic in kdump kernel Check if get_next_variable() is actually valid pointer before calling it. In kdump kernel this method is set to NULL that causes panic during the kexec-ed kernel boot. Tested with QEMU and OVMF firmware. Fixes: bad267f9e18f ("efi: verify that variable services are supported") Signed-off-by: Oleksandr Tymoshenko Signed-off-by: Ard Biesheuvel --- diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 8859fb0b006d3..fdf07dd6f4591 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -203,6 +203,8 @@ static bool generic_ops_supported(void) name_size = sizeof(name); + if (!efi.get_next_variable) + return false; status = efi.get_next_variable(&name_size, &name, &guid); if (status == EFI_UNSUPPORTED) return false;