[PATCH] timekeeping: Reject cross timestamps for invalid AUX clocks
From: Avi Weiss
Date: Sat Oct 31 2026 - 08:22:42 EST
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>
---
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