This is a note to let you know that I've just added the patch titled random: remove use_input_pool parameter from crng_reseed() to the 4.14-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-remove-use_input_pool-parameter-from-crng_reseed.patch and it can be found in the queue-4.14 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 Thu Jun 16 07:08:33 PM CEST 2022 From: Eric Biggers <ebiggers@xxxxxxxxxx> Date: Fri, 4 Feb 2022 14:17:33 -0800 Subject: random: remove use_input_pool parameter from crng_reseed() From: Eric Biggers <ebiggers@xxxxxxxxxx> commit 5d58ea3a31cc98b9fa563f6921d3d043bf0103d1 upstream. The primary_crng is always reseeded from the input_pool, while the NUMA crngs are always reseeded from the primary_crng. Remove the redundant 'use_input_pool' parameter from crng_reseed() and just directly check whether the crng is the primary_crng. Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/char/random.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -365,7 +365,7 @@ static struct { static void extract_entropy(void *buf, size_t nbytes); -static void crng_reseed(struct crng_state *crng, bool use_input_pool); +static void crng_reseed(struct crng_state *crng); /* * This function adds bytes into the entropy "pool". It does not @@ -464,7 +464,7 @@ static void credit_entropy_bits(int nbit trace_credit_entropy_bits(nbits, entropy_count, _RET_IP_); if (crng_init < 2 && entropy_count >= POOL_MIN_BITS) - crng_reseed(&primary_crng, true); + crng_reseed(&primary_crng); } /********************************************************************* @@ -700,7 +700,7 @@ static int crng_slow_load(const u8 *cp, return 1; } -static void crng_reseed(struct crng_state *crng, bool use_input_pool) +static void crng_reseed(struct crng_state *crng) { unsigned long flags; int i; @@ -709,7 +709,7 @@ static void crng_reseed(struct crng_stat u32 key[8]; } buf; - if (use_input_pool) { + if (crng == &primary_crng) { int entropy_count; do { entropy_count = READ_ONCE(input_pool.entropy_count); @@ -747,7 +747,7 @@ static void _extract_crng(struct crng_st init_time = READ_ONCE(crng->init_time); if (time_after(READ_ONCE(crng_global_init_time), init_time) || time_after(jiffies, init_time + CRNG_RESEED_INTERVAL)) - crng_reseed(crng, crng == &primary_crng); + crng_reseed(crng); } spin_lock_irqsave(&crng->lock, flags); chacha20_block(&crng->state[0], out); @@ -1546,7 +1546,7 @@ static long random_ioctl(struct file *f, return -EPERM; if (crng_init < 2) return -ENODATA; - crng_reseed(&primary_crng, true); + crng_reseed(&primary_crng); WRITE_ONCE(crng_global_init_time, jiffies - 1); return 0; default: Patches currently in stable-queue which might be from ebiggers@xxxxxxxxxx are queue-4.14/random-do-not-take-pool-spinlock-at-boot.patch queue-4.14/random-introduce-drain_entropy-helper-to-declutter-crng_reseed.patch queue-4.14/random-fix-locking-in-crng_fast_load.patch queue-4.14/random-group-userspace-read-write-functions.patch queue-4.14/random-make-credit_entropy_bits-always-safe.patch queue-4.14/crypto-chacha20-fix-chacha20_block-keystream-alignment-again.patch queue-4.14/random-pull-add_hwgenerator_randomness-declaration-into-random.h.patch queue-4.14/random-unify-early-init-crng-load-accounting.patch queue-4.14/random-use-blake2s-instead-of-sha1-in-extraction.patch queue-4.14/random-initialize-chacha20-constants-with-correct-endianness.patch queue-4.14/random-group-entropy-extraction-functions.patch queue-4.14/random-rewrite-header-introductory-comment.patch queue-4.14/random-remove-ifdef-d-out-interrupt-bench.patch queue-4.14/random-tie-batched-entropy-generation-to-base_crng-generation.patch queue-4.14/random-use-linear-min-entropy-accumulation-crediting.patch queue-4.14/random-remove-batched-entropy-locking.patch queue-4.14/random-inline-leaves-of-rand_initialize.patch queue-4.14/random-remove-use_input_pool-parameter-from-crng_reseed.patch queue-4.14/random-zero-buffer-after-reading-entropy-from-userspace.patch queue-4.14/random-remove-whitespace-and-reorder-includes.patch queue-4.14/random-simplify-entropy-debiting.patch queue-4.14/random-document-crng_fast_key_erasure-destination-possibility.patch queue-4.14/random-absorb-fast-pool-into-input-pool-after-fast-load.patch queue-4.14/random-use-rdseed-instead-of-rdrand-in-entropy-extraction.patch queue-4.14/random-remove-dead-code-left-over-from-blocking-pool.patch queue-4.14/random-use-computational-hash-for-entropy-extraction.patch queue-4.14/random-always-wake-up-entropy-writers-after-extraction.patch queue-4.14/random-do-not-xor-rdrand-when-writing-into-dev-random.patch queue-4.14/random-group-initialization-wait-functions.patch queue-4.14/random-remove-unused-tracepoints.patch queue-4.14/crypto-chacha20-fix-keystream-alignment-for-chacha20_block.patch queue-4.14/random-check-for-crng_init-0-in-add_device_randomness.patch queue-4.14/crypto-blake2s-include-linux-bug.h-instead-of-asm-bug.h.patch queue-4.14/random-group-entropy-collection-functions.patch queue-4.14/random-remove-useless-header-comment.patch queue-4.14/random-remove-outdated-int_max-6-check-in-urandom_read.patch queue-4.14/random-do-not-pretend-to-handle-premature-next-security-model.patch queue-4.14/random-avoid-arch_get_random_seed_long-when-collecting-irq-randomness.patch queue-4.14/random-reseed-more-often-immediately-after-booting.patch queue-4.14/random-ensure-early-rdseed-goes-through-mixer-on-init.patch queue-4.14/crypto-blake2s-adjust-include-guard-naming.patch queue-4.14/random-use-hash-function-for-crng_slow_load.patch