diff options
| author | Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de> | 2026-07-31 16:17:43 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-09-07 17:37:27 +0200 |
| commit | bc59dac50cb45a725f7a50760c7cc72a0964f722 (patch) | |
| tree | 70155971cc9fcfee7ebb814e0f96f025085ae3a7 | |
| parent | 3fb244bc24aee4ccee04311e6f4642282a77eb0e (diff) | |
| download | linux-stable-bc59dac50cb45a725f7a50760c7cc72a0964f722.tar.gz linux-stable-bc59dac50cb45a725f7a50760c7cc72a0964f722.zip | |
timekeeping: Check the return value of tk_get_aux_ts64 in __do_adjtimex()
commit 4b61084b11bcecce86d03804ff30f8d7b465593c upstream.
If the auxiliary clock is disabled during tk_get_aux_ts64() but is enabled
before tks->clock_valid is checked, then uninitialized stackdata will be
used in the calculations and indirectly leaked to userspace.
The same race window also exists after this change and also for the core
timekeeper. But in these cases the only effect would be incorrect
adjustments and this is userspace's responsibility to avoid this.
Fixes: 4eca49d0b621 ("timekeeping: Prepare do_adtimex() for auxiliary clocks")
Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260731-timekeeping-aux-adjtimex-return-v1-1-b7fea4692886@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | kernel/time/timekeeping.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b1b5ec43c0f2..696bb119c56e 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -2943,10 +2943,12 @@ static int __do_adjtimex(struct tk_data *tkd, struct __kernel_timex *txc, return ret; add_device_randomness(txc, sizeof(*txc)); - if (!aux_clock) + if (!aux_clock) { ktime_get_real_ts64(&ts); - else - tk_get_aux_ts64(tkd->timekeeper.id, &ts); + } else { + if (!tk_get_aux_ts64(tkd->timekeeper.id, &ts)) + return -ENODEV; + } add_device_randomness(&ts, sizeof(ts)); |
