]> git.hungrycats.org Git - linux/commitdiff
efi: fix panic in kdump kernel
authorOleksandr Tymoshenko <ovt@google.com>
Sat, 23 Mar 2024 06:33:33 +0000 (06:33 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:45 +0000 (15:11 +0200)
[ Upstream commit 62b71cd73d41ddac6b1760402bbe8c4932e23531 ]

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 <ovt@google.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/efi/efi.c

index 9d3910d1abe19eb63d26e88ea86e3c669924cf1b..abdfcb5aa470c0b8e23bbe0bfac2ec0af17b0c68 100644 (file)
@@ -199,6 +199,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;