]> git.baikalelectronics.ru Git - kernel.git/commit
random: Add callback API for random pool readiness
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 9 Jun 2015 10:19:39 +0000 (18:19 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 10 Jun 2015 11:13:56 +0000 (19:13 +0800)
commit8f94bb5cfd2d5b66dda3302c3ec5012a9df6e6ef
tree90a62c129458c30fcce01cdde1c4c5f34820fb5a
parentc311053dedf40499a790d7a67a9c0c7444853ebc
random: Add callback API for random pool readiness

The get_blocking_random_bytes API is broken because the wait can
be arbitrarily long (potentially forever) so there is no safe way
of calling it from within the kernel.

This patch replaces it with a callback API instead.  The callback
is invoked potentially from interrupt context so the user needs
to schedule their own work thread if necessary.

In addition to adding callbacks, they can also be removed as
otherwise this opens up a way for user-space to allocate kernel
memory with no bound (by opening algif_rng descriptors and then
closing them).

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/random.c
include/linux/random.h