efi: fix panic in kdump kernel
PATCH 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.
--- drivers/firmware/efi/efi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/efi/efi.c +2 -0
@@ -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;
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
Quoted 5 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.
Sounds like you want a Fixes and CC stable tag here as well.
Quoted 10 lines
Signed-off-by Oleksandr Tymoshenko <[email protected]>--- drivers/firmware/efi/efi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/firmware/efi/efi.c +0
-0
drivers/firmware/efi/efi.c static bool generic_ops_supported(void) · line 207
Quoted 5 lines
drivers/firmware/efi/efi.c +2
-0@@ -203,6 +203,8 @@ static bool generic_ops_supported(void) name_size =sizeof (name); +if (efi.get_next_variable ==NULL ) +return false;
Please move this check above the name_size initialisation and make sure you have a new line before and after.
I'd also suggest rewriting this as:
if (!efi.get_next_variable) return false;
drivers/firmware/efi/efi.c static bool generic_ops_supported(void) · line 210
Quoted 3 lines
drivers/firmware/efi/efi.c +0
-0status = efi.get_next_variable (&name_size, &name, &guid);if (status ==EFI_UNSUPPORTED )return false;
Johan