[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKXuJqjBUnW_6P8SQ2jePA9n3UddgPOpe3EwoC+k=_5KRno1wQ@mail.gmail.com>
Date: Mon, 19 Dec 2022 08:40:03 -0600
From: Steev Klimaszewski <steev@...i.org>
To: Johan Hovold <johan+linaro@...nel.org>
Cc: Ard Biesheuvel <ardb@...nel.org>,
"Jason A. Donenfeld" <Jason@...c4.com>, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bjorn Andersson <andersson@...nel.org>,
Andrew Halaney <ahalaney@...hat.com>
Subject: Re: [PATCH v2] efi: random: fix NULL-deref when refreshing seed
On Mon, Dec 19, 2022 at 4:13 AM Johan Hovold <johan+linaro@...nel.org> wrote:
>
> Do not try to refresh the RNG seed in case the firmware does not support
> setting variables.
>
> This is specifically needed to prevent a NULL-pointer dereference on the
> Lenovo X13s with some firmware revisions, or more generally, whenever
> the runtime services have been disabled (e.g. efi=noruntime or with
> PREEMPT_RT).
>
> Fixes: e7b813b32a42 ("efi: random: refresh non-volatile random seed when RNG is initialized")
> Reported-by: Steev Klimaszewski <steev@...i.org>
> Reported-by: Bjorn Andersson <andersson@...nel.org>
> Tested-by: Andrew Halaney <ahalaney@...hat.com> # sc8280xp-lenovo-thinkpad-x13s
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
> ---
>
> Changes in v2
> - amend commit message with a comment on this being needed whenever the
> runtime services have been disabled
>
>
> drivers/firmware/efi/efi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 31a4090c66b3..09716eebe8ac 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -429,7 +429,9 @@ static int __init efisubsys_init(void)
> platform_device_register_simple("efi_secret", 0, NULL, 0);
> #endif
>
> - execute_with_initialized_rng(&refresh_nv_rng_seed_nb);
> + if (efi_rt_services_supported(EFI_RT_SUPPORTED_SET_VARIABLE))
> + execute_with_initialized_rng(&refresh_nv_rng_seed_nb);
> +
> return 0;
>
> err_remove_group:
> --
> 2.37.4
>
Andrew already sent one, but also confirming since I reported it, this
fixes the issue for me as well.
Tested-by: Steev Klimaszewski <steev@...i.org>
Powered by blists - more mailing lists