]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blobdiff - kernel/time/timekeeping.c
timekeeping/vsyscall: Prevent math overflow in BOOTTIME update
[mirror_ubuntu-eoan-kernel.git] / kernel / time / timekeeping.c
index d911c8470149e87330838153abfd511f868fe383..ca69290bee2a3131358993e9a3bbc32c6a9a9231 100644 (file)
@@ -146,6 +146,11 @@ static void tk_set_wall_to_mono(struct timekeeper *tk, struct timespec64 wtm)
 static inline void tk_update_sleep_time(struct timekeeper *tk, ktime_t delta)
 {
        tk->offs_boot = ktime_add(tk->offs_boot, delta);
+       /*
+        * Timespec representation for VDSO update to avoid 64bit division
+        * on every update.
+        */
+       tk->monotonic_to_boot = ktime_to_timespec64(tk->offs_boot);
 }
 
 /*