public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Oleksandr Tymoshenko <ovt@google.com>
Cc: Ard Biesheuvel <ardb@kernel.org>,
	johan+linaro@kernel.org, linux-efi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] efi: fix panic in kdump kernel
Date: Fri, 22 Mar 2024 09:00:21 +0100	[thread overview]
Message-ID: <Zf06lazi4bBbzTVg@hovoldconsulting.com> (raw)
In-Reply-To: <20240322010846.305860-1-ovt@google.com>

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@google.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

      reply	other threads:[~2024-03-22  8:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22  1:08 [PATCH] efi: fix panic in kdump kernel Oleksandr Tymoshenko
2024-03-22  8:00 ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zf06lazi4bBbzTVg@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=ardb@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ovt@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox