forked from Minki/linux
random: use arch_get_random*_early() in random_init()
While reworking the archrandom handling, commitd349ab99ee
("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:d349ab99ee
("random: handle archrandom with multiple longs") Cc: stable@vger.kernel.org Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
2375886721
commit
f5e4ec155d
@ -791,13 +791,13 @@ void __init random_init_early(const char *command_line)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0, arch_bits = sizeof(entropy) * 8; i < ARRAY_SIZE(entropy);) {
|
for (i = 0, arch_bits = sizeof(entropy) * 8; i < ARRAY_SIZE(entropy);) {
|
||||||
longs = arch_get_random_seed_longs(entropy, ARRAY_SIZE(entropy) - i);
|
longs = arch_get_random_seed_longs_early(entropy, ARRAY_SIZE(entropy) - i);
|
||||||
if (longs) {
|
if (longs) {
|
||||||
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
|
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
|
||||||
i += longs;
|
i += longs;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
longs = arch_get_random_longs(entropy, ARRAY_SIZE(entropy) - i);
|
longs = arch_get_random_longs_early(entropy, ARRAY_SIZE(entropy) - i);
|
||||||
if (longs) {
|
if (longs) {
|
||||||
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
|
_mix_pool_bytes(entropy, sizeof(*entropy) * longs);
|
||||||
i += longs;
|
i += longs;
|
||||||
|
Loading…
Reference in New Issue
Block a user