Skip to content

Commit 41a1585

Browse files
jhovoldzx2c4
authored andcommitted
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, or more generally, whenever the runtime services have been disabled (e.g. efi=noruntime or with PREEMPT_RT). Fixes: e7b813b ("efi: random: refresh non-volatile random seed when RNG is initialized") Reported-by: Steev Klimaszewski <[email protected]> Reported-by: Bjorn Andersson <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> Tested-by: Andrew Halaney <[email protected]> # sc8280xp-lenovo-thinkpad-x13s Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 6bb20c1 commit 41a1585

File tree

1 file changed

+3
-1
lines changed
  • drivers/firmware/efi

1 file changed

+3
-1
lines changed

drivers/firmware/efi/efi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,9 @@ static int __init efisubsys_init(void)
429429
platform_device_register_simple("efi_secret", 0, NULL, 0);
430430
#endif
431431

432-
execute_with_initialized_rng(&refresh_nv_rng_seed_nb);
432+
if (efi_rt_services_supported(EFI_RT_SUPPORTED_SET_VARIABLE))
433+
execute_with_initialized_rng(&refresh_nv_rng_seed_nb);
434+
433435
return 0;
434436

435437
err_remove_group:

0 commit comments

Comments
 (0)