linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/davinci: fix memory leak on clockevent on error return
@ 2019-11-09 15:58 Colin King
  2019-11-10 15:59 ` Bartosz Golaszewski
  0 siblings, 1 reply; 4+ messages in thread
From: Colin King @ 2019-11-09 15:58 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Bartosz Golaszewski, linux-kernel
  Cc: kernel-janitors

From: Colin Ian King <colin.king@canonical.com>

In the case where request_irq fails, the return path does not kfree
clockevent and hence we have a memory leak.  Fix this by kfree'ing
clockevent before returning.

Addresses-Coverity: ("Resource leak")
Fixes: 721154f972aa ("clocksource/drivers/davinci: Add support for clockevents")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/clocksource/timer-davinci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/timer-davinci.c
index 62745c962049..910d4d2f0d64 100644
--- a/drivers/clocksource/timer-davinci.c
+++ b/drivers/clocksource/timer-davinci.c
@@ -299,6 +299,7 @@ int __init davinci_timer_register(struct clk *clk,
 			 "clockevent/tim12", clockevent);
 	if (rv) {
 		pr_err("Unable to request the clockevent interrupt");
+		kfree(clockevent);
 		return rv;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-12  8:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 15:58 [PATCH] clocksource/drivers/davinci: fix memory leak on clockevent on error return Colin King
2019-11-10 15:59 ` Bartosz Golaszewski
2019-11-11 23:37   ` Thomas Gleixner
2019-11-12  8:34     ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).