[PATCH 5/6] clocksource/drivers/timer-owl: Fix clock reference leak in owl_timer_init

Wentao Liang vulab at iscas.ac.cn
Mon Sep 14 22:22:40 PDT 2026


owl_timer_init() looks up the timer clock with of_clk_get(), which takes
a reference on the clock, and only uses it to read the timer rate. The
pointer is a local variable that is lost on return and clk_put() is
never called, so the reference is leaked on the clocksource_mmio_init()
and request_irq() failure paths as well as on success.

Drop the reference with clk_put() right after the rate has been read,
which covers all the remaining paths since the clock is not used
afterwards.

Fixes: 4be78a86c506 ("clocksource: Add Owl timer")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/clocksource/timer-owl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/timer-owl.c b/drivers/clocksource/timer-owl.c
index ac97420bfa7c..fa347f430563 100644
--- a/drivers/clocksource/timer-owl.c
+++ b/drivers/clocksource/timer-owl.c
@@ -142,6 +142,7 @@ static int __init owl_timer_init(struct device_node *node)
 	}
 
 	rate = clk_get_rate(clk);
+	clk_put(clk);
 
 	owl_timer_reset(owl_clksrc_base);
 	owl_timer_set_enabled(owl_clksrc_base, true);
-- 
2.34.1




More information about the linux-arm-kernel mailing list