]> git.hungrycats.org Git - linux/commitdiff
[PATCH] xtime value may become incorrect
authorVladimir Grouzdev <vladimir.grouzdev@jaluna.com>
Mon, 18 Oct 2004 16:08:10 +0000 (09:08 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 18 Oct 2004 16:08:10 +0000 (09:08 -0700)
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 <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/timer.c

index 66486fb30dab41b1f60c8a1d1cba011863879ba7..0a390a67c0f22b555924b2092dc7ec026243d5a3 100644 (file)
@@ -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,