random: rate limit unseeded randomness warnings

commit 4e00b339e264802851aff8e73cde7d24b57b18ce upstream.

On systems without sufficient boot randomness, no point spamming dmesg.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Theodore Ts'o 2018-04-25 01:12:32 -04:00 committed by Greg Kroah-Hartman
parent 32988e2d4e
commit 44ea43bef7

View File

@ -1637,8 +1637,9 @@ static void _warn_unseeded_randomness(const char *func_name, void *caller,
#ifndef CONFIG_WARN_ALL_UNSEEDED_RANDOM
print_once = true;
#endif
pr_notice("random: %s called from %pS with crng_init=%d\n",
func_name, caller, crng_init);
if (__ratelimit(&unseeded_warning))
pr_notice("random: %s called from %pS with crng_init=%d\n",
func_name, caller, crng_init);
}
/*