random: Wake up all getrandom(2) callers when pool is ready
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 21 May 2015 08:19:54 +0000 (16:19 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 27 May 2015 09:51:45 +0000 (17:51 +0800)
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>
drivers/char/random.c

index 9cd6968e2f924bf7eb5c545c4298445651d5665d..8b8c46b5fd5ce4565746842798d786a997570933 100644 (file)
@@ -660,7 +660,7 @@ retry:
                r->entropy_total = 0;
                if (r == &nonblocking_pool) {
                        prandom_reseed_late();
-                       wake_up_interruptible(&urandom_init_wait);
+                       wake_up_all(&urandom_init_wait);
                        pr_notice("random: %s pool is initialized\n", r->name);
                }
        }