mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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
65326fb405
commit
1bb09a594b
1 changed files with 9 additions and 0 deletions
|
@ -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 a new issue