Commit b7d44d94 authored by Satoru Takeuchi's avatar Satoru Takeuchi Committed by Rusty Russell

hw_random: free rng_buffer at module exit

rng-core module allocates rng_buffer by kmalloc() since commit
f7f154f1. But this buffer won't be
freed and there is a memory leak possibility at module exit.
Signed-off-by: default avatarSatoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent aabd6a8f
......@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng)
}
EXPORT_SYMBOL_GPL(hwrng_unregister);
static void __exit hwrng_exit(void)
{
mutex_lock(&rng_mutex);
BUG_ON(current_rng);
kfree(rng_buffer);
mutex_unlock(&rng_mutex);
}
module_exit(hwrng_exit);
MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment