All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH stable 5.10 5.15 5.17 5.18] Revert "random: use static branch for crng_ready()"
@ 2022-06-07  8:40 Jason A. Donenfeld
  2022-06-07  9:14 ` Greg KH
       [not found] ` <165459326824547@kroah.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Jason A. Donenfeld @ 2022-06-07  8:40 UTC (permalink / raw)
  To: stable, gregkh; +Cc: Jason A. Donenfeld

This reverts upstream commit f5bda35fba615ace70a656d4700423fa6c9bebee
from stable. It's not essential and will take some time during 5.19 to
work out properly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7a66eec08e37..0cfbfa8d5b50 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -78,8 +78,7 @@ static enum {
 	CRNG_EARLY = 1, /* At least POOL_EARLY_BITS collected */
 	CRNG_READY = 2  /* Fully initialized with POOL_READY_BITS collected */
 } crng_init __read_mostly = CRNG_EMPTY;
-static DEFINE_STATIC_KEY_FALSE(crng_is_ready);
-#define crng_ready() (static_branch_likely(&crng_is_ready) || crng_init >= CRNG_READY)
+#define crng_ready() (likely(crng_init >= CRNG_READY))
 /* Various types of waiters for crng_init->CRNG_READY transition. */
 static DECLARE_WAIT_QUEUE_HEAD(crng_init_wait);
 static struct fasync_struct *fasync;
@@ -109,11 +108,6 @@ bool rng_is_initialized(void)
 }
 EXPORT_SYMBOL(rng_is_initialized);
 
-static void __cold crng_set_ready(struct work_struct *work)
-{
-	static_branch_enable(&crng_is_ready);
-}
-
 /* Used by wait_for_random_bytes(), and considered an entropy collector, below. */
 static void try_to_generate_entropy(void);
 
@@ -267,7 +261,7 @@ static void crng_reseed(void)
 		++next_gen;
 	WRITE_ONCE(base_crng.generation, next_gen);
 	WRITE_ONCE(base_crng.birth, jiffies);
-	if (!static_branch_likely(&crng_is_ready))
+	if (!crng_ready())
 		crng_init = CRNG_READY;
 	spin_unlock_irqrestore(&base_crng.lock, flags);
 	memzero_explicit(key, sizeof(key));
@@ -710,7 +704,6 @@ static void extract_entropy(void *buf, size_t len)
 
 static void __cold _credit_init_bits(size_t bits)
 {
-	static struct execute_work set_ready;
 	unsigned int new, orig, add;
 	unsigned long flags;
 
@@ -726,7 +719,6 @@ static void __cold _credit_init_bits(size_t bits)
 
 	if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) {
 		crng_reseed(); /* Sets crng_init to CRNG_READY under base_crng.lock. */
-		execute_in_process_context(crng_set_ready, &set_ready);
 		process_random_ready_list();
 		wake_up_interruptible(&crng_init_wait);
 		kill_fasync(&fasync, SIGIO, POLL_IN);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH stable 5.10 5.15 5.17 5.18] Revert "random: use static branch for crng_ready()"
  2022-06-07  8:40 [PATCH stable 5.10 5.15 5.17 5.18] Revert "random: use static branch for crng_ready()" Jason A. Donenfeld
@ 2022-06-07  9:14 ` Greg KH
       [not found] ` <165459326824547@kroah.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-06-07  9:14 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: stable

On Tue, Jun 07, 2022 at 10:40:05AM +0200, Jason A. Donenfeld wrote:
> This reverts upstream commit f5bda35fba615ace70a656d4700423fa6c9bebee
> from stable. It's not essential and will take some time during 5.19 to
> work out properly.
> 
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> ---
>  drivers/char/random.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch "Revert "random: use static branch for crng_ready()"" has been added to the 4.14-stable tree
       [not found] ` <165459326824547@kroah.com>
@ 2022-06-07  9:24   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-06-07  9:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jason, stable-commits

On Tue, Jun 07, 2022 at 11:14:28AM +0200, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     Revert "random: use static branch for crng_ready()"
> 
> 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:
>      revert-random-use-static-branch-for-crng_ready.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@vger.kernel.org> know about it.

Oops, nope, it didn't apply here, sorry, scripts went crazy for a
minute...

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-07  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07  8:40 [PATCH stable 5.10 5.15 5.17 5.18] Revert "random: use static branch for crng_ready()" Jason A. Donenfeld
2022-06-07  9:14 ` Greg KH
     [not found] ` <165459326824547@kroah.com>
2022-06-07  9:24   ` Patch "Revert "random: use static branch for crng_ready()"" has been added to the 4.14-stable tree Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.