diff mbox series

efi: fix panic in kdump kernel

Message ID 20240322010846.305860-1-ovt@google.com
State New
Headers show
Series efi: fix panic in kdump kernel | expand

Commit Message

Oleksandr Tymoshenko March 22, 2024, 1:08 a.m. UTC
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.

Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
---
 drivers/firmware/efi/efi.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 8859fb0b006d..800b85807a02 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 == NULL)
+		return false;
 	status = efi.get_next_variable(&name_size, &name, &guid);
 	if (status == EFI_UNSUPPORTED)
 		return false;