Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31043fde authored by Reinazhard's avatar Reinazhard Committed by Bharath
Browse files

soc/qcom: early_random: Fix race during early random pool initialization



Recent random.c upstream introduced early random pool init race.
As Jason A. Donenfeld suggests, change the call to
add_hwgenerator_randomness to be add_bootloader_randomness,
and remove the last argument with the left shift operator usage.

This fixes the splash boot issue after latest RNG upstream and adapts
Qualcomm's early random driver to it.

Test: Device boots, RNG probes successfully alongside early_random driver.

Change-Id: Id75c66bf6d65bf077570a68145d4a4d200747865
Suggested-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Co-authored-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarReinazhard <reinazhard@gmail.com>
[ Tashar02: Reword the commit message & description ]
Signed-off-by: default avatarTashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
(cherry picked from commit bd8265f32a21efc95d9b2d7473ca30e17352b0eb)
Signed-off-by: default avatarAlbert I <kras@raphielgang.org>
(cherry picked from commit 4548acd02da089abdf17f60a368ccbc432cbe98f)
parent ca1f658d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -67,8 +67,7 @@ void __init init_random_pool(void)
						RANDOM_BUFFER_SIZE);
		bytes_received = (bytes_received <= RANDOM_BUFFER_SIZE) ?
					bytes_received : RANDOM_BUFFER_SIZE;
		add_hwgenerator_randomness(random_buffer, bytes_received,
					   bytes_received << 3);
		add_bootloader_randomness(random_buffer, bytes_received);
	}
}