This is a note to let you know that I've just added the patch titled random: access primary_pool directly rather than through pointer to the 4.19-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-access-primary_pool-directly-rather-than-through-pointer.patch and it can be found in the queue-4.19 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 Fri Jun 17 08:58:56 AM CEST 2022 From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 30 Jan 2022 22:03:19 +0100 Subject: random: access primary_pool directly rather than through pointer From: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx> commit ebf7606388732ecf2821ca21087e9446cb4a5b57 upstream. Both crng_initialize_primary() and crng_init_try_arch_early() are only called for the primary_pool. Accessing it directly instead of through a function parameter simplifies the code. Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/char/random.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -762,7 +762,7 @@ static bool crng_init_try_arch(struct cr return arch_init; } -static bool __init crng_init_try_arch_early(struct crng_state *crng) +static bool __init crng_init_try_arch_early(void) { int i; bool arch_init = true; @@ -774,7 +774,7 @@ static bool __init crng_init_try_arch_ea rv = random_get_entropy(); arch_init = false; } - crng->state[i] ^= rv; + primary_crng.state[i] ^= rv; } return arch_init; @@ -788,16 +788,16 @@ static void crng_initialize_secondary(st crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; } -static void __init crng_initialize_primary(struct crng_state *crng) +static void __init crng_initialize_primary(void) { - _extract_entropy(&crng->state[4], sizeof(u32) * 12); - if (crng_init_try_arch_early(crng) && trust_cpu && crng_init < 2) { + _extract_entropy(&primary_crng.state[4], sizeof(u32) * 12); + if (crng_init_try_arch_early() && trust_cpu && crng_init < 2) { invalidate_batched_entropy(); numa_crng_init(); crng_init = 2; pr_notice("crng init done (trusting CPU's manufacturer)\n"); } - crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; + primary_crng.init_time = jiffies - CRNG_RESEED_INTERVAL - 1; } static void crng_finalize_init(struct crng_state *crng) @@ -1698,7 +1698,7 @@ int __init rand_initialize(void) init_std_data(); if (crng_need_final_init) crng_finalize_init(&primary_crng); - crng_initialize_primary(&primary_crng); + crng_initialize_primary(); crng_global_init_time = jiffies; if (ratelimit_disable) { urandom_warning.interval = 0; Patches currently in stable-queue which might be from linux@xxxxxxxxxxxxxxxxxxxx are queue-4.19/random-do-not-take-pool-spinlock-at-boot.patch queue-4.19/random-simplify-arithmetic-function-flow-in-account.patch queue-4.19/random-introduce-drain_entropy-helper-to-declutter-crng_reseed.patch queue-4.19/random-fix-locking-in-crng_fast_load.patch queue-4.19/random-cleanup-uuid-handling.patch queue-4.19/random-group-userspace-read-write-functions.patch queue-4.19/random-make-credit_entropy_bits-always-safe.patch queue-4.19/random-do-not-re-init-if-crng_reseed-completes-before-primary-init.patch queue-4.19/random-pull-add_hwgenerator_randomness-declaration-into-random.h.patch queue-4.19/random-unify-early-init-crng-load-accounting.patch queue-4.19/random-remove-incomplete-last_data-logic.patch queue-4.19/random-group-entropy-extraction-functions.patch queue-4.19/random-add-proper-spdx-header.patch queue-4.19/random-rewrite-header-introductory-comment.patch queue-4.19/random-remove-ifdef-d-out-interrupt-bench.patch queue-4.19/random-tie-batched-entropy-generation-to-base_crng-generation.patch queue-4.19/random-use-linear-min-entropy-accumulation-crediting.patch queue-4.19/random-remove-batched-entropy-locking.patch queue-4.19/random-continually-use-hwgenerator-randomness.patch queue-4.19/random-access-input_pool_data-directly-rather-than-through-pointer.patch queue-4.19/random-inline-leaves-of-rand_initialize.patch queue-4.19/random-cleanup-poolinfo-abstraction.patch queue-4.19/random-handle-latent-entropy-and-command-line-from-random_init.patch queue-4.19/random-credit-architectural-init-the-exact-amount.patch queue-4.19/random-replace-custom-notifier-chain-with-standard-one.patch queue-4.19/random-avoid-initializing-twice-in-credit-race.patch queue-4.19/random-zero-buffer-after-reading-entropy-from-userspace.patch queue-4.19/random-remove-whitespace-and-reorder-includes.patch queue-4.19/random-clear-fast-pool-crng-and-batches-in-cpuhp-bring-up.patch queue-4.19/random-do-crng-pre-init-loading-in-worker-rather-than-irq.patch queue-4.19/random-early-initialization-of-chacha-constants.patch queue-4.19/random-simplify-entropy-debiting.patch queue-4.19/random-skip-fast_init-if-hwrng-provides-large-chunk-of-entropy.patch queue-4.19/random-avoid-checking-crng_ready-twice-in-random_init.patch queue-4.19/random-group-sysctl-functions.patch queue-4.19/random-don-t-let-644-read-only-sysctls-be-written-to.patch queue-4.19/random-only-wake-up-writers-after-zap-if-threshold-was-passed.patch queue-4.19/random-check-for-signal-and-try-earlier-when-generating-entropy.patch queue-4.19/random-absorb-fast-pool-into-input-pool-after-fast-load.patch queue-4.19/random-give-sysctl_random_min_urandom_seed-a-more-sensible-value.patch queue-4.19/random-cleanup-fractional-entropy-shift-constants.patch queue-4.19/random-use-rdseed-instead-of-rdrand-in-entropy-extraction.patch queue-4.19/random-move-initialization-functions-out-of-hot-pages.patch queue-4.19/random-use-computational-hash-for-entropy-extraction.patch queue-4.19/random-round-robin-registers-as-ulong-not-u32.patch queue-4.19/random-always-wake-up-entropy-writers-after-extraction.patch queue-4.19/random-do-not-xor-rdrand-when-writing-into-dev-random.patch queue-4.19/random-only-call-crng_finalize_init-for-primary_crng.patch queue-4.19/random-cleanup-integer-types.patch queue-4.19/random-re-add-removed-comment-about-get_random_-u32-u64-reseeding.patch queue-4.19/random-unify-cycles_t-and-jiffies-usage-and-types.patch queue-4.19/random-group-initialization-wait-functions.patch queue-4.19/random-remove-unused-extract_entropy-reserved-argument.patch queue-4.19/random-access-primary_pool-directly-rather-than-through-pointer.patch queue-4.19/random-remove-unused-tracepoints.patch queue-4.19/random-treat-bootloader-trust-toggle-the-same-way-as-cpu-trust-toggle.patch queue-4.19/random-make-consistent-usage-of-crng_ready.patch queue-4.19/random-check-for-signals-after-page-of-pool-writes.patch queue-4.19/random-make-random_get_entropy-return-an-unsigned-long.patch queue-4.19/random-check-for-crng_init-0-in-add_device_randomness.patch queue-4.19/random-defer-fast-pool-mixing-to-worker.patch queue-4.19/random-harmonize-crng-init-done-messages.patch queue-4.19/random-use-static-branch-for-crng_ready.patch queue-4.19/random-rather-than-entropy_store-abstraction-use-global.patch queue-4.19/random-group-entropy-collection-functions.patch queue-4.19/random-de-duplicate-input_pool-constants.patch queue-4.19/random-mix-build-time-latent-entropy-into-pool-at-init.patch queue-4.19/random-remove-useless-header-comment.patch queue-4.19/random-remove-outdated-int_max-6-check-in-urandom_read.patch queue-4.19/random-mix-bootloader-randomness-into-pool.patch queue-4.19/random-do-not-use-batches-when-crng_ready.patch queue-4.19/random-use-is_enabled-config_numa-instead-of-ifdefs.patch queue-4.19/random-use-symbolic-constants-for-crng_init-states.patch queue-4.19/random-ensure-early-rdseed-goes-through-mixer-on-init.patch queue-4.19/random-deobfuscate-irq-u32-u64-contributions.patch queue-4.19/random-fix-crash-on-multiple-early-calls-to-add_bootloader_randomness.patch queue-4.19/random-remove-ratelimiting-for-in-kernel-unseeded-randomness.patch queue-4.19/random-prepend-remaining-pool-constants-with-pool_.patch queue-4.19/random-remove-unused-output_pool-constants.patch queue-4.19/random-use-hash-function-for-crng_slow_load.patch