random: only wake up writers after zap if threshold was passed
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 22 Feb 2022 13:01:57 +0000 (14:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:09 +0000 (09:29 +0200)
commitc169e7a09cd48a3f2ae2978e6713fd72f09f284c
treef6f9b5cc0474d0ea9a7301d4d1428f3074532919
parente400ba11a241386dc27e57c35c00f61dce92e2f4
random: only wake up writers after zap if threshold was passed

commit a3f9e8910e1584d7725ef7d5ac870920d42d0bb4 upstream.

The only time that we need to wake up /dev/random writers on
RNDCLEARPOOL/RNDZAPPOOL is when we're changing from a value that is
greater than or equal to POOL_MIN_BITS to zero, because if we're
changing from below POOL_MIN_BITS to zero, the writers are already
unblocked.

Cc: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c