* [PATCH] timekeeping: Reject cross timestamps for invalid AUX clocks
@ 2026-10-31 12:22 Avi Weiss
0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-10-31 12:22 UTC (permalink / raw)
To: Thomas Gleixner, John Stultz
Cc: Stephen Boyd, Miroslav Lichvar, linux-kernel, Avi Weiss
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@gmail.com>
---
kernel/time/timekeeping.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index dcf47f1ffdcf..7817c97dab61 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
base-commit: 36aad21d50d1af3f6954bb0c988257a908202477
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-31 12:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 12:22 [PATCH] timekeeping: Reject cross timestamps for invalid AUX clocks Avi Weiss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®