[tip: timers/urgent] timekeeping: Reject cross timestamps for invalid AUX clocks
From: tip-bot2 for Avi Weiss
Date: Mon Nov 09 2026 - 14:23:38 EST
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 67f1969e29b692ab3cfcc97ba175b9109212de00
Gitweb: https://git.kernel.org/tip/67f1969e29b692ab3cfcc97ba175b9109212de00
Author: Avi Weiss <thnkslprpt@xxxxxxxxx>
AuthorDate: Sat, 31 Oct 2026 14:22:17 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Mon, 09 Nov 2026 20:15:58 +01:00
timekeeping: Reject cross timestamps for invalid AUX clocks
get_device_system_crosststamp() accepts AUX clock IDs even when the
corresponding timekeeper is disabled. A never-enabled AUX timekeeper
has no initialized clocksource, and a previously enabled one can
retain stale timekeeping data.
Return -ENODEV before calling the device timestamp callback when the
selected timekeeper is invalid.
Fixes: 9aebde8af6fe ("timekeeping: Add support for AUX clock cross timestamping")
Signed-off-by: Avi Weiss <thnkslprpt@xxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Link: https://patch.msgid.link/20261031122218.118921-1-thnkslprpt@xxxxxxxxx
---
kernel/time/timekeeping.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 7d7a737..806ab91 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1600,6 +1600,9 @@ int get_device_system_crosststamp(int (*get_time_fn)
do {
seq = read_seqcount_begin(&tkd->seq);
+ if (!tk->clock_valid)
+ return -ENODEV;
+
/*
* Try to synchronously capture device time and a system
* counter value calling back into the device driver