From f871dbd2296a9851d0806c6d0097b4dec6f43f48 Mon Sep 17 00:00:00 2001 From: Vladimir Grouzdev Date: Mon, 18 Oct 2004 09:08:10 -0700 Subject: [PATCH] [PATCH] xtime value may become incorrect The xtime value may become incorrect when the update_wall_time(ticks) function is called with "ticks" > 1. In such a case, the xtime variable is updated multiple times inside the loop but it is normalized only once outside of the loop. This bug was reported at: http://bugme.osdl.org/show_bug.cgi?id=3403 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/timer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/timer.c b/kernel/timer.c index 66486fb30dab4..0a390a67c0f22 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -790,13 +790,12 @@ static void update_wall_time(unsigned long ticks) do { ticks--; update_wall_time_one_tick(); + if (xtime.tv_nsec >= 1000000000) { + xtime.tv_nsec -= 1000000000; + xtime.tv_sec++; + second_overflow(); + } } while (ticks); - - if (xtime.tv_nsec >= 1000000000) { - xtime.tv_nsec -= 1000000000; - xtime.tv_sec++; - second_overflow(); - } } static inline void do_process_times(struct task_struct *p, -- 2.53.0