lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241031-clk-renesas-cpg-mssr-cleanup-v1-1-628274ecbfcb@gmail.com>
Date: Thu, 31 Oct 2024 00:25:56 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Geert Uytterhoeven <geert+renesas@...der.be>, 
 Michael Turquette <mturquette@...libre.com>, 
 Stephen Boyd <sboyd@...nel.org>, 
 Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
Cc: linux-renesas-soc@...r.kernel.org, linux-clk@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 Javier Carrasco <javier.carrasco.cruz@...il.com>, stable@...r.kernel.org
Subject: [PATCH 1/2] clk: renesas: cpg-mssr: fix 'soc' node handling in
 cpg_mssr_reserved_init()

A device_node reference obtained via of_find_node_by_path() requires
explicit calls to of_node_put() after it is no longer required to avoid
leaking the resource.

Add the missing calls to of_node_put(soc) in all execution paths when
'soc' is no longer required (one error path, and the success path).

Cc: stable@...r.kernel.org
Fixes: 6aa175476490 ("clk: renesas: cpg-mssr: Ignore all clocks assigned to non-Linux system")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
 drivers/clk/renesas/renesas-cpg-mssr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 79e7a90c3b1b..5dc89b1009fe 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -1022,6 +1022,7 @@ static int __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
 
 			ids = krealloc_array(ids, (num + 1), sizeof(*ids), GFP_KERNEL);
 			if (!ids) {
+				of_node_put(soc);
 				of_node_put(it.node);
 				return -ENOMEM;
 			}
@@ -1036,6 +1037,7 @@ static int __init cpg_mssr_reserved_init(struct cpg_mssr_priv *priv,
 			num++;
 		}
 	}
+	of_node_put(soc);
 
 	priv->num_reserved_ids	= num;
 	priv->reserved_ids	= ids;

-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ