提交 b7d44d94 编写于 作者: S Satoru Takeuchi 提交者: 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: NSatoru Takeuchi <satoru.takeuchi@gmail.com>
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册