[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zf06lazi4bBbzTVg@hovoldconsulting.com>
Date: Fri, 22 Mar 2024 09:00:21 +0100
From: Johan Hovold <johan@...nel.org>
To: Oleksandr Tymoshenko <ovt@...gle.com>
Cc: Ard Biesheuvel <ardb@...nel.org>, johan+linaro@...nel.org,
linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] efi: fix panic in kdump kernel
On Fri, Mar 22, 2024 at 01:08:45AM +0000, Oleksandr Tymoshenko wrote:
> 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.
> Signed-off-by: Oleksandr Tymoshenko <ovt@...gle.com>
> ---
> drivers/firmware/efi/efi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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;
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;
> status = efi.get_next_variable(&name_size, &name, &guid);
> if (status == EFI_UNSUPPORTED)
> return false;
Johan
Powered by blists - more mailing lists