summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorVladimir Grouzdev <vladimir.grouzdev@jaluna.com>2004-10-18 09:08:10 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-18 09:08:10 -0700
commitf871dbd2296a9851d0806c6d0097b4dec6f43f48 (patch)
treed5d2fd9ef0e3e12ec0c52ae2703dcf2e3328d5df /kernel
parent74477c85796fdb19271cf0402910a634980db300 (diff)
[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 <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/timer.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/timer.c b/kernel/timer.c
index 66486fb30dab..0a390a67c0f2 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,