mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 17:57:38 -04:00
crypto: rng - Free default RNG on module exit
When the rng module is removed the default RNG will be leaked.
Call crypto_del_default_rng to free it if possible.
Fixes: 7cecadb7cc ("crypto: rng - Do not free default RNG when it becomes unused")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
11
crypto/rng.c
11
crypto/rng.c
@@ -230,5 +230,16 @@ void crypto_unregister_rngs(struct rng_alg *algs, int count)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_unregister_rngs);
|
||||
|
||||
static void __exit rng_exit(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = crypto_del_default_rng();
|
||||
if (err)
|
||||
pr_err("Failed delete default RNG: %d\n", err);
|
||||
}
|
||||
|
||||
module_exit(rng_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Random Number Generator");
|
||||
|
||||
Reference in New Issue
Block a user