]> git.baikalelectronics.ru Git - kernel.git/commit
hwrng: core - break out of hwrng_fillfn if current rng is not trusted
authorDominik Brodowski <linux@dominikbrodowski.net>
Mon, 24 Jan 2022 20:29:50 +0000 (21:29 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 5 Feb 2022 04:10:50 +0000 (15:10 +1100)
commita8214c82bb90c2aeac2ad884fda93c90c735ab64
treef99258f1acb4bde35571a42be31a8fda9b16c224
parentee4c00c4c4d4dfbf4d1f5a5cf777a49088a14a69
hwrng: core - break out of hwrng_fillfn if current rng is not trusted

For two reasons, current_quality may become zero within the rngd
kernel thread: (1) The user lowers current_quality to 0 by writing
to the sysfs module parameter file (note that increasing the quality
from zero is without effect at the moment), or (2) there are two or
more hwrng devices registered, and those which provide quality>0 are
unregistered, but one with quality==0 remains.

If current_quality is 0, the randomness is not trusted and cannot help
to increase the entropy count. That will lead to continuous calls to
the hwrngd thread and continuous stirring of the input pool with
untrusted bits.

Cc: Matt Mackall <mpm@selenic.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/core.c