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] [day] [month] [year] [list]
Message-ID: <172443718918.2215.9073356657150571388.tip-bot2@tip-bot2>
Date: Fri, 23 Aug 2024 18:19:49 -0000
From: "tip-bot2 for Chen Yufan" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Chen Yufan <chenyufan@...o.com>, Thomas Gleixner <tglx@...utronix.de>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: timers/core] timekeeping: Use time_after() in
 timekeeping_check_update()

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     42db2c2cb5ac3572380a9489b8f8bbe0e534dfc7
Gitweb:        https://git.kernel.org/tip/42db2c2cb5ac3572380a9489b8f8bbe0e534dfc7
Author:        Chen Yufan <chenyufan@...o.com>
AuthorDate:    Thu, 22 Aug 2024 15:07:17 +08:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Fri, 23 Aug 2024 20:15:11 +02:00

timekeeping: Use time_after() in timekeeping_check_update()

The open coded comparison does not handle wrap arounds correctly.

Signed-off-by: Chen Yufan <chenyufan@...o.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/all/20240822070717.12773-1-chenyufan@vivo.com

---
 kernel/time/timekeeping.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 2fa87dc..4fa42a1 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -217,7 +217,7 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
 	}
 
 	if (tk->underflow_seen) {
-		if (jiffies - tk->last_warning > WARNING_FREQ) {
+		if (time_after(jiffies, tk->last_warning + WARNING_FREQ)) {
 			printk_deferred("WARNING: Underflow in clocksource '%s' observed, time update ignored.\n", name);
 			printk_deferred("         Please report this, consider using a different clocksource, if possible.\n");
 			printk_deferred("         Your kernel is probably still fine.\n");
@@ -227,7 +227,7 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
 	}
 
 	if (tk->overflow_seen) {
-		if (jiffies - tk->last_warning > WARNING_FREQ) {
+		if (time_after(jiffies, tk->last_warning + WARNING_FREQ)) {
 			printk_deferred("WARNING: Overflow in clocksource '%s' observed, time update capped.\n", name);
 			printk_deferred("         Please report this, consider using a different clocksource, if possible.\n");
 			printk_deferred("         Your kernel is probably still fine.\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ