Skip to content

Commit f5e4ec1

Browse files
jpbruckerzx2c4
authored andcommitted
random: use arch_get_random*_early() in random_init()
While reworking the archrandom handling, commit d349ab9 ("random: handle archrandom with multiple longs") switched to the non-early archrandom helpers in random_init(), which broke initialization of the entropy pool from the arm64 random generator. Indeed at that point the arm64 CPU features, which verify that all CPUs have compatible capabilities, are not finalized so arch_get_random_seed_longs() is unsuccessful. Instead random_init() should use the _early functions, which check only the boot CPU on arm64. On other architectures the _early functions directly call the normal ones. Fixes: d349ab9 ("random: handle archrandom with multiple longs") Cc: [email protected] Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 2375886 commit f5e4ec1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/random.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,13 @@ void __init random_init_early(const char *command_line)
791791
#endif
792792

793793
for (i = 0, arch_bits = sizeof(entropy) * 8; i < ARRAY_SIZE(entropy);) {
794-
longs = arch_get_random_seed_longs(entropy, ARRAY_SIZE(entropy) - i);
794+
longs = arch_get_random_seed_longs_early(entropy, ARRAY_SIZE(entropy) - i);
795795
if (longs) {
796796
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
797797
i += longs;
798798
continue;
799799
}
800-
longs = arch_get_random_longs(entropy, ARRAY_SIZE(entropy) - i);
800+
longs = arch_get_random_longs_early(entropy, ARRAY_SIZE(entropy) - i);
801801
if (longs) {
802802
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
803803
i += longs;

0 commit comments

Comments
 (0)