aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hw_random
diff options
context:
space:
mode:
authorSatoru Takeuchi <satoru.takeuchi@gmail.com>2013-03-19 20:58:51 -0400
committerRusty Russell <rusty@rustcorp.com.au>2013-03-19 20:59:37 -0400
commitb7d44d9487a11e835de10908f4ab30b4290c0b7f (patch)
tree0877897709f09da01e40b55e1329926accd401a8 /drivers/char/hw_random
parentaabd6a8fa5a933bdf968cd86e34122745c1960e8 (diff)
hw_random: free rng_buffer at module exit
rng-core module allocates rng_buffer by kmalloc() since commit f7f154f1246ccc5a0a7e9ce50932627d60a0c878. 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>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r--drivers/char/hw_random/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 69ae5972713c..a0f7724852eb 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -380,6 +380,15 @@ void hwrng_unregister(struct hwrng *rng)
380} 380}
381EXPORT_SYMBOL_GPL(hwrng_unregister); 381EXPORT_SYMBOL_GPL(hwrng_unregister);
382 382
383static void __exit hwrng_exit(void)
384{
385 mutex_lock(&rng_mutex);
386 BUG_ON(current_rng);
387 kfree(rng_buffer);
388 mutex_unlock(&rng_mutex);
389}
390
391module_exit(hwrng_exit);
383 392
384MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); 393MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
385MODULE_LICENSE("GPL"); 394MODULE_LICENSE("GPL");