[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221216091514.6298-1-johan+linaro@kernel.org>
Date: Fri, 16 Dec 2022 10:15:14 +0100
From: Johan Hovold <johan+linaro@...nel.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, linux-efi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Johan Hovold <johan+linaro@...nel.org>,
Steev Klimaszewski <steev@...i.org>,
Bjorn Andersson <andersson@...nel.org>
Subject: [PATCH] efi: random: fix NULL-deref when refreshing seed
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.
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>
Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
---
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 2e168e5b97de..1a9e2f70c550 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -432,7 +432,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
Powered by blists - more mailing lists