]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
timekeeping: Avoid duplicate leap state update
authorAnna-Maria Behnsen <anna-maria@linutronix.de>
Wed, 9 Oct 2024 08:28:56 +0000 (10:28 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 25 Oct 2024 17:49:13 +0000 (19:49 +0200)
do_adjtimex() invokes tk_update_leap_state() unconditionally even when a
previous invocation of timekeeping_update() already did that update.

Put it into the else path which is invoked when timekeeping_update() is not
called.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20241009-devel-anna-maria-b4-timers-ptp-timekeeping-v2-3-554456a44a15@linutronix.de
kernel/time/timekeeping.c

index ff98a0b54b54e8db7aa7fd1679ccf683711d59fe..14aaa44104ebd5a172bfc5d1ebdba38621b91a94 100644 (file)
@@ -2715,8 +2715,9 @@ int do_adjtimex(struct __kernel_timex *txc)
                __timekeeping_set_tai_offset(tk, tai);
                timekeeping_update(tk, TK_MIRROR | TK_CLOCK_WAS_SET);
                clock_set = true;
+       } else {
+               tk_update_leap_state(tk);
        }
-       tk_update_leap_state(tk);
 
        write_seqcount_end(&tk_core.seq);
        raw_spin_unlock_irqrestore(&timekeeper_lock, flags);