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-next>] [day] [month] [year] [list]
Date: Sat, 20 Jan 2024 10:07:11 +0000
From: Cristian Marussi <cristian.marussi@....com>
To: linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org
Cc: sudeep.holla@....com,
	peng.fan@....nxp.com,
	Cristian Marussi <cristian.marussi@....com>,
	Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>,
	linux-clk@...r.kernel.org
Subject: [PATCH] clk: Check ops are available in clk_gate_restore_context

Add a check in clk_gate_restore_context() to assure that the clock enable
and disable ops are available before calling them.

CC: Michael Turquette <mturquette@...libre.com>
CC: Stephen Boyd <sboyd@...nel.org>
CC: linux-clk@...r.kernel.org
Fixes: 9be766274db4 ("clk: Clean up suspend/resume coding style")
Signed-off-by: Cristian Marussi <cristian.marussi@....com>
---
Spotted this by code inspection.
I may be missing something, though, given my limited familiarity with CLK.
---
 drivers/clk/clk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f0940af485a5..79b90a8099d7 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1200,9 +1200,11 @@ void clk_gate_restore_context(struct clk_hw *hw)
 	struct clk_core *core = hw->core;
 
 	if (core->enable_count)
-		core->ops->enable(hw);
+		if (core->ops->enable)
+			core->ops->enable(hw);
 	else
-		core->ops->disable(hw);
+		if (core->ops->disable)
+			core->ops->disable(hw);
 }
 EXPORT_SYMBOL_GPL(clk_gate_restore_context);
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ