summaryrefslogtreecommitdiffstats
path: root/arch/xtensa
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:27:36 +0200
commitf1eaf4ba5372ad111f687a80c67e270708e14c23 (patch)
tree14a743587b55598f0f4f4f90286d2114cacc23f3 /arch/xtensa
parent0715d0e60052662c3f225342062f174dd721d1c7 (diff)
downloadlinux-stable-f1eaf4ba5372ad111f687a80c67e270708e14c23.tar.gz
linux-stable-f1eaf4ba5372ad111f687a80c67e270708e14c23.tar.bz2
linux-stable-f1eaf4ba5372ad111f687a80c67e270708e14c23.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>
Diffstat (limited to 'arch/xtensa')
-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 378186b5eb40..071c5f59d620 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;