From: Avi Weiss <thnkslprpt@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>, John Stultz <jstultz@google.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>,
linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] timekeeping: Reject cross timestamps for invalid AUX clocks
Date: Sat, 31 Oct 2026 14:22:17 +0200 [thread overview]
Message-ID: <20261031122218.118921-1-thnkslprpt@gmail.com> (raw)
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
reply other threads:[~2026-10-31 12:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261031122218.118921-1-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=sboyd@kernel.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®