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]
Message-ID: <tencent_E88A86F3126F065BA4E3D4FC9CEB1A9A2406@qq.com>
Date: Thu, 18 Dec 2025 10:31:24 +0800
From: Zhu Ling <1536943441@...com>
To: linux-watchdog@...r.kernel.org
Cc: wim@...ux-watchdog.org,
	linux@...ck-us.net,
	linux-kernel@...r.kernel.org,
	Zhu Ling <1536943441@...com>
Subject: [PATCH] watchdog: sbsa-gwdt: clamp timeout before updating wdd->timeout

sbsa_gwdt_set_timeout() updates wdd->timeout before clamping the user
requested value to the hardware-supported range. As a result,
WDIOC_GETTIMEOUT and sysfs may report a timeout larger than what is
actually programmed into the hardware.

Clamp the timeout first and then update wdd->timeout so that
userspace-visible values always reflect the effective hardware
timeout.

Signed-off-by: Zhu Ling <1536943441@...com>
---
 drivers/watchdog/sbsa_gwdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 6ce1bfb39..826469645 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -155,8 +155,8 @@ static int sbsa_gwdt_set_timeout(struct watchdog_device *wdd,
 {
 	struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd);
 
-	wdd->timeout = timeout;
 	timeout = clamp_t(unsigned int, timeout, 1, wdd->max_hw_heartbeat_ms / 1000);
+	wdd->timeout = timeout;
 
 	if (action)
 		sbsa_gwdt_reg_write((u64)gwdt->clk * timeout, gwdt);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ