linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] efi: fix panic in kdump kernel
@ 2024-03-23  6:33 Oleksandr Tymoshenko
  2024-03-23 12:15 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Oleksandr Tymoshenko @ 2024-03-23  6:33 UTC (permalink / raw)
  To: Ard Biesheuvel, Johan Hovold; +Cc: ovt, stable, linux-efi, linux-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")
Cc: stable@vger.kernel.org
Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
---
Changes in v2:
  - Style fix
  - Added Cc: stable
  - Added Fixes: trailer
---
 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..fdf07dd6f459 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)
+		return false;
 	status = efi.get_next_variable(&name_size, &name, &guid);
 	if (status == EFI_UNSUPPORTED)
 		return false;
-- 
2.44.0.396.g6e790dbe36-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] efi: fix panic in kdump kernel
  2024-03-23  6:33 [PATCH v2] efi: fix panic in kdump kernel Oleksandr Tymoshenko
@ 2024-03-23 12:15 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2024-03-23 12:15 UTC (permalink / raw)
  To: Oleksandr Tymoshenko; +Cc: Johan Hovold, stable, linux-efi, linux-kernel

On Sat, 23 Mar 2024 at 08:33, Oleksandr Tymoshenko <ovt@google.com> 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.
>
> Fixes: bad267f9e18f ("efi: verify that variable services are supported")
> Cc: stable@vger.kernel.org
> Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>

Thanks. Queued as a fix.

> ---
> Changes in v2:
>   - Style fix
>   - Added Cc: stable
>   - Added Fixes: trailer
> ---
>  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..fdf07dd6f459 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)
> +               return false;
>         status = efi.get_next_variable(&name_size, &name, &guid);
>         if (status == EFI_UNSUPPORTED)
>                 return false;
> --
> 2.44.0.396.g6e790dbe36-goog
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-23 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-23  6:33 [PATCH v2] efi: fix panic in kdump kernel Oleksandr Tymoshenko
2024-03-23 12:15 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).