]> git.baikalelectronics.ru Git - kernel.git/commit
random: throttle hwrng writes if no entropy is credited
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 20 Sep 2022 14:12:00 +0000 (16:12 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 23 Sep 2022 10:27:57 +0000 (12:27 +0200)
commitb0d57a5e58fded0147e2a723d751596429134599
tree9459588ff43af5215f615cf945fd2db7fbefe43a
parentaf6f9819f4ed8db25ff80f9e1a7c63f2251c5524
random: throttle hwrng writes if no entropy is credited

If a hwrng source does not provide an entropy estimate, it currently
does not contribute at all to the CRNG. In order to help fix this, in
case add_hwgenerator_randomness() is called with the entropy parameter
set to zero, go to sleep until one reseed interval has passed.

While the hwrng thread currently only runs under conditions where this
is non-zero, this change is not harmful and prepares for future updates
to the hwrng core.

Cc: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
drivers/char/random.c