mirror of https://gitee.com/openkylin/linux.git
hw_random: free rng_buffer at module exit
rng-core module allocates rng_buffer by kmalloc() since commit
f7f154f124
. But this buffer won't be
freed and there is a memory leak possibility at module exit.
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
aabd6a8fa5
commit
b7d44d9487
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue