]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
random: always fill buffer in get_random_bytes_wait
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 4 Feb 2018 22:07:46 +0000 (23:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:46:24 +0000 (11:46 +0200)
commitd218c093c864432fc6038682868f3d3c7c69e0cd
tree7d45aa5f317c4ce33f71d3bf4e0a6dbceceab837
parentf83ff022179e7ba4b5e14d96524fc0b74b6e3845
random: always fill buffer in get_random_bytes_wait

commit 25e3fca492035a2e1d4ac6e3b1edd9c1acd48897 upstream.

In the unfortunate event that a developer fails to check the return
value of get_random_bytes_wait, or simply wants to make a "best effort"
attempt, for whatever that's worth, it's much better to still fill the
buffer with _something_ rather than catastrophically failing in the case
of an interruption. This is both a defense in depth measure against
inevitable programming bugs, as well as a means of making the API a bit
more useful.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/random.h