From ad7154f084e30ed053a616fd1ebe1d969c2b742a Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu, 21 May 2015 16:19:54 +0800
Subject: [PATCH 2/3] BACKPORT: random: Wake up all getrandom(2) callers when
 pool is ready

Clean cherry pick of 1d9de44e268d880cbe2d0bd3be1ef0661f93fd34.

If more than one application invokes getrandom(2) before the pool
is ready, then all bar one will be stuck forever because we use
wake_up_interruptible which wakes up a single task.

This patch replaces it with wake_up_all.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Bug: http://b/29621447
Change-Id: I5dfd7abac10898802f030e0a2af7110809283328
(cherry picked from commit 1d9de44e268d880cbe2d0bd3be1ef0661f93fd34)
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 8d09b53c9102..702b5bcad2c8 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -615,7 +615,7 @@ retry:
 		r->initialized = 1;
 		r->entropy_total = 0;
 		if (r == &nonblocking_pool) {
-			wake_up_interruptible(&urandom_init_wait);
+			wake_up_all(&urandom_init_wait);
 			pr_notice("random: %s pool is initialized\n", r->name);
 		}
 	}
-- 
2.19.0

