[PATCH] x86: fix potential jiffies overflow in timer_resume()
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Mon, 6 Mar 2006 23:42:42 +0000 (15:42 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 7 Mar 2006 02:40:44 +0000 (18:40 -0800)
i386 timer_resume is updating jiffies, not jiffies_64.  It looks there is a
potential overflow problem.  And jiffies_64 and wall_jiffies should be
protected by xtime_lock.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/time.c

index a14d594bfbebb2b9345e45619fb4387154057653..9d3074759856e0e1ff508b9ca6aec2b077c27075 100644 (file)
@@ -412,9 +412,9 @@ static int timer_resume(struct sys_device *dev)
        write_seqlock_irqsave(&xtime_lock, flags);
        xtime.tv_sec = sec;
        xtime.tv_nsec = 0;
-       write_sequnlock_irqrestore(&xtime_lock, flags);
-       jiffies += sleep_length;
+       jiffies_64 += sleep_length;
        wall_jiffies += sleep_length;
+       write_sequnlock_irqrestore(&xtime_lock, flags);
        if (last_timer->resume)
                last_timer->resume();
        cur_timer = last_timer;