diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2019-08-15 12:33:05 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2019-08-15 12:33:05 -0400 |
commit | 1255aed5a913b44566888bbe63dd57c96327a89b (patch) | |
tree | f637ede110e7a5f7826bbd069108e7d1dfad9ede | |
parent | 5ef80b3560f610e61fd31b949182e693e04cba37 (diff) | |
download | longterm-queue-4.18-1255aed5a913b44566888bbe63dd57c96327a89b.tar.gz |
random: ctxt refresh
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | queue/random-add-a-spinlock_t-to-struct-batched_entropy.patch | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/queue/random-add-a-spinlock_t-to-struct-batched_entropy.patch b/queue/random-add-a-spinlock_t-to-struct-batched_entropy.patch index 20e4bdf..a263bfa 100644 --- a/queue/random-add-a-spinlock_t-to-struct-batched_entropy.patch +++ b/queue/random-add-a-spinlock_t-to-struct-batched_entropy.patch @@ -1,4 +1,4 @@ -From b7d5dc21072cda7124d13eae2aefb7343ef94197 Mon Sep 17 00:00:00 2001 +From 7e51835ac51a99dc9d6f6bac3632a3f0c77456f0 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat, 20 Apr 2019 00:09:51 -0400 Subject: [PATCH] random: add a spinlock_t to struct batched_entropy @@ -69,11 +69,11 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu> diff --git a/drivers/char/random.c b/drivers/char/random.c -index 587df86c1661..a42b3d764da8 100644 +index bd449ad52442..13c69a681659 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c -@@ -2282,8 +2282,8 @@ struct batched_entropy { - u32 entropy_u32[CHACHA_BLOCK_SIZE / sizeof(u32)]; +@@ -2186,8 +2186,8 @@ struct batched_entropy { + u32 entropy_u32[CHACHA20_BLOCK_SIZE / sizeof(u32)]; }; unsigned int position; + spinlock_t batch_lock; @@ -82,7 +82,7 @@ index 587df86c1661..a42b3d764da8 100644 /* * Get a random word for internal kernel use only. The quality of the random -@@ -2293,12 +2293,14 @@ static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_ +@@ -2197,12 +2197,14 @@ static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_ * wait_for_random_bytes() should be called and return 0 at least once * at any point prior. */ @@ -100,7 +100,7 @@ index 587df86c1661..a42b3d764da8 100644 struct batched_entropy *batch; static void *previous; -@@ -2313,28 +2315,25 @@ u64 get_random_u64(void) +@@ -2217,28 +2219,25 @@ u64 get_random_u64(void) warn_unseeded_randomness(&previous); @@ -111,7 +111,7 @@ index 587df86c1661..a42b3d764da8 100644 + batch = raw_cpu_ptr(&batched_entropy_u64); + spin_lock_irqsave(&batch->batch_lock, flags); if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) { - extract_crng((u8 *)batch->entropy_u64); + extract_crng((__u32 *)batch->entropy_u64); batch->position = 0; } ret = batch->entropy_u64[batch->position++]; @@ -136,7 +136,7 @@ index 587df86c1661..a42b3d764da8 100644 struct batched_entropy *batch; static void *previous; -@@ -2343,18 +2342,14 @@ u32 get_random_u32(void) +@@ -2247,18 +2246,14 @@ u32 get_random_u32(void) warn_unseeded_randomness(&previous); @@ -147,7 +147,7 @@ index 587df86c1661..a42b3d764da8 100644 + batch = raw_cpu_ptr(&batched_entropy_u32); + spin_lock_irqsave(&batch->batch_lock, flags); if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) { - extract_crng((u8 *)batch->entropy_u32); + extract_crng(batch->entropy_u32); batch->position = 0; } ret = batch->entropy_u32[batch->position++]; @@ -158,7 +158,7 @@ index 587df86c1661..a42b3d764da8 100644 return ret; } EXPORT_SYMBOL(get_random_u32); -@@ -2368,12 +2363,19 @@ static void invalidate_batched_entropy(void) +@@ -2272,12 +2267,19 @@ static void invalidate_batched_entropy(void) int cpu; unsigned long flags; |