Skip to content

Commit be36f9e

Browse files
zx2c4Ingo Molnar
authored andcommitted
efi: READ_ONCE rng seed size before munmap
This function is consistent with using size instead of seed->size (except for one place that this patch fixes), but it reads seed->size without using READ_ONCE, which means the compiler might still do something unwanted. So, this commit simply adds the READ_ONCE wrapper. Fixes: 6362598 ("efi: Add support for seeding the RNG from a UEFI ...") Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: [email protected] Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 8319e9d commit be36f9e

File tree

1 file changed

+2
-2
lines changed
  • drivers/firmware/efi

1 file changed

+2
-2
lines changed

drivers/firmware/efi/efi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
552552

553553
seed = early_memremap(efi.rng_seed, sizeof(*seed));
554554
if (seed != NULL) {
555-
size = seed->size;
555+
size = READ_ONCE(seed->size);
556556
early_memunmap(seed, sizeof(*seed));
557557
} else {
558558
pr_err("Could not map UEFI random seed!\n");
@@ -562,7 +562,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
562562
sizeof(*seed) + size);
563563
if (seed != NULL) {
564564
pr_notice("seeding entropy pool\n");
565-
add_bootloader_randomness(seed->bits, seed->size);
565+
add_bootloader_randomness(seed->bits, size);
566566
early_memunmap(seed, sizeof(*seed) + size);
567567
} else {
568568
pr_err("Could not map UEFI random seed!\n");

0 commit comments

Comments
 (0)