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: <20240815005520.1192374-6-sboyd@kernel.org>
Date: Wed, 14 Aug 2024 17:55:11 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Michael Turquette <mturquette@...libre.com>,
	Stephen Boyd <sboyd@...nel.org>
Cc: linux-kernel@...r.kernel.org,
	linux-clk@...r.kernel.org,
	patches@...ts.linux.dev,
	Nuno Sá <nuno.sa@...log.com>
Subject: [PATCH 05/12] clk: Fail phase APIs after clk_hw is unregistered

The clk phase APIs don't fail when a clk_hw is unregistered. Add some
nodrv clk_ops that return failure so that clk_get_phase() starts failing
when a clk_hw is unregistered.

Cc: Nuno Sá <nuno.sa@...log.com>
Fixes: e59c5371fb9d ("clk: introduce clk_set_phase function & callback")
Signed-off-by: Stephen Boyd <sboyd@...nel.org>
---
 drivers/clk/clk.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f5415aa70f81..8909294cc52e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4486,7 +4486,7 @@ EXPORT_SYMBOL_GPL(of_clk_hw_register);
  * after clk_unregister() was called on a clock and until last clock
  * consumer calls clk_put() and the struct clk object is freed.
  */
-static int clk_nodrv_prepare_enable(struct clk_hw *hw)
+static int clk_nodrv_prepare_enable_get_phase(struct clk_hw *hw)
 {
 	return -ENXIO;
 }
@@ -4513,14 +4513,21 @@ static int clk_nodrv_determine_rate(struct clk_hw *hw,
 	return -ENXIO;
 }
 
+static int clk_nodrv_set_phase(struct clk_hw *hw, int degrees)
+{
+	return -ENXIO;
+}
+
 static const struct clk_ops clk_nodrv_ops = {
-	.enable		= clk_nodrv_prepare_enable,
+	.enable		= clk_nodrv_prepare_enable_get_phase,
 	.disable	= clk_nodrv_disable_unprepare,
-	.prepare	= clk_nodrv_prepare_enable,
+	.prepare	= clk_nodrv_prepare_enable_get_phase,
 	.unprepare	= clk_nodrv_disable_unprepare,
 	.determine_rate	= clk_nodrv_determine_rate,
 	.set_rate	= clk_nodrv_set_rate,
 	.set_parent	= clk_nodrv_set_parent,
+	.get_phase	= clk_nodrv_prepare_enable_get_phase,
+	.set_phase	= clk_nodrv_set_phase,
 };
 
 static void clk_core_evict_parent_cache_subtree(struct clk_core *root,
-- 
https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/
https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ