Skip to contentSkip to conversation

efi: fix panic in kdump kernel

PATCH In review Oleksandr Tymoshenko 2 participants 2 messages Mar 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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")

---
Changes in v2:
- Style fix
- Added Cc: stable
- Added Fixes: trailer

---
 drivers/firmware/efi/efi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/efi/efi.c +2 -0
index 8859fb0b006d..fdf07dd6f459 100644
@@ -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;
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
maintainer
#1 lore raw
Quoted 10 lines · Oleksandr Tymoshenko

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")

Thanks. Queued as a fix.

Quoted 25 lines

---
Changes in v2:
- Style fix
- Added Cc: stable
- Added Fixes: trailer

---
 drivers/firmware/efi/efi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/efi/efi.c +2 -1
index 8859fb0b006d..fdf07dd6f459 100644
@@ -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;
--

2.44.0.396.g6e790dbe36-goog