This is a note to let you know that I've just added the patch titled random: avoid checking crng_ready() twice in random_init() to the 5.17-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: random-avoid-checking-crng_ready-twice-in-random_init.patch and it can be found in the queue-5.17 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Jun 13 11:00:52 AM CEST 2022 From: "Jason A. Donenfeld" <Jason@xxxxxxxxx> Date: Mon, 13 Jun 2022 10:07:47 +0200 Subject: random: avoid checking crng_ready() twice in random_init() To: stable@xxxxxxxxxxxxxxx, gregkh@xxxxxxxxxxxxxxxxxxx Message-ID: <20220613080749.153222-2-Jason@xxxxxxxxx> From: "Jason A. Donenfeld" <Jason@xxxxxxxxx> commit 9b29b6b20376ab64e1b043df6301d8a92378e631 upstream. The current flow expands to: if (crng_ready()) ... else if (...) if (!crng_ready()) ... The second crng_ready() call is redundant, but can't so easily be optimized out by the compiler. This commit simplifies that to: if (crng_ready() ... else if (...) ... Fixes: 560181c27b58 ("random: move initialization functions out of hot pages") Cc: stable@xxxxxxxxxxxxxxx Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -838,7 +838,7 @@ int __init random_init(const char *comma if (crng_ready()) crng_reseed(); else if (trust_cpu) - credit_init_bits(arch_bytes * 8); + _credit_init_bits(arch_bytes * 8); return 0; } Patches currently in stable-queue which might be from Jason@xxxxxxxxx are queue-5.17/random-mark-bootloader-randomness-code-as-__init.patch queue-5.17/random-avoid-checking-crng_ready-twice-in-random_init.patch queue-5.17/random-account-for-arch-randomness-in-bits.patch