summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-06-17 20:44:32 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-02 16:17:15 +0200
commit3e5eb904d9ba657308fc75a5de434b0e58dcb8d7 (patch)
treee0b908a6b92c392a0e26dcb27d5663d5b38196e6
parentb12d5c52f073a0420622aaf2f21b615cce8b36cc (diff)
downloadlinux-3e5eb904d9ba657308fc75a5de434b0e58dcb8d7.tar.gz
linux-3e5eb904d9ba657308fc75a5de434b0e58dcb8d7.tar.bz2
linux-3e5eb904d9ba657308fc75a5de434b0e58dcb8d7.zip
xtensa: Fix refcount leak bug in time.c
commit a0117dc956429f2ede17b323046e1968d1849150 upstream. In calibrate_ccount(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Cc: stable@vger.kernel.org Signed-off-by: Liang He <windhl@126.com> Message-Id: <20220617124432.4049006-1-windhl@126.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/xtensa/kernel/time.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 2251a6e0973a..d4b4386df568 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -146,6 +146,7 @@ static void __init calibrate_ccount(void)
cpu = of_find_compatible_node(NULL, NULL, "cdns,xtensa-cpu");
if (cpu) {
clk = of_clk_get(cpu, 0);
+ of_node_put(cpu);
if (!IS_ERR(clk)) {
ccount_freq = clk_get_rate(clk);
return;