[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <175318783799.1420.6062932319598101589.tip-bot2@tip-bot2>
Date: Tue, 22 Jul 2025 12:37:17 -0000
From: tip-bot2 for Markus Blöchl <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: markus@...chl.de, Thomas Gleixner <tglx@...utronix.de>,
John Stultz <jstultz@...gle.com>, stable@...r.kernel.org, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/urgent] timekeeping: Zero initialize system_counterval
when querying time from phc drivers
The following commit has been merged into the timers/urgent branch of tip:
Commit-ID: 67c632b4a7fbd6b76a08b86f4950f0f84de93439
Gitweb: https://git.kernel.org/tip/67c632b4a7fbd6b76a08b86f4950f0f84de93439
Author: Markus Blöchl <markus@...chl.de>
AuthorDate: Sun, 20 Jul 2025 15:54:51 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 22 Jul 2025 14:25:21 +02:00
timekeeping: Zero initialize system_counterval when querying time from phc drivers
Most drivers only populate the fields cycles and cs_id of system_counterval
in their get_time_fn() callback for get_device_system_crosststamp(), unless
they explicitly provide nanosecond values.
When the use_nsecs field was added to struct system_counterval, most
drivers did not care. Clock sources other than CSID_GENERIC could then get
converted in convert_base_to_cs() based on an uninitialized use_nsecs field,
which usually results in -EINVAL during the following range check.
Pass in a fully zero initialized system_counterval_t to cure that.
Fixes: 6b2e29977518 ("timekeeping: Provide infrastructure for converting to/from a base clock")
Signed-off-by: Markus Blöchl <markus@...chl.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: John Stultz <jstultz@...gle.com>
Cc: stable@...r.kernel.org
Link: https://lore.kernel.org/all/20250720-timekeeping_uninit_crossts-v2-1-f513c885b7c2@blochl.de
---
kernel/time/timekeeping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index a009c91..83c65f3 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1256,7 +1256,7 @@ int get_device_system_crosststamp(int (*get_time_fn)
struct system_time_snapshot *history_begin,
struct system_device_crosststamp *xtstamp)
{
- struct system_counterval_t system_counterval;
+ struct system_counterval_t system_counterval = {};
struct timekeeper *tk = &tk_core.timekeeper;
u64 cycles, now, interval_start;
unsigned int clock_was_set_seq = 0;
Powered by blists - more mailing lists