]> err.no Git - linux-2.6/commitdiff
[PATCH] hrtimers: fix oldvalue return in setitimer
authorThomas Gleixner <tglx@linutronix.de>
Wed, 1 Feb 2006 11:05:09 +0000 (03:05 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 1 Feb 2006 16:53:12 +0000 (08:53 -0800)
This resolves bugzilla bug#5617.  The oldvalue of the timer was read after the
timer was cancelled, so the remaining time was always zero.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/itimer.c

index 6433d06855063d477c4c037e00ad660aea4319fd..379be2f8c84c33445b9cea549fe2c7215d3d6cc4 100644 (file)
@@ -155,16 +155,16 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
 again:
                spin_lock_irq(&tsk->sighand->siglock);
                timer = &tsk->signal->real_timer;
-               /* We are sharing ->siglock with it_real_fn() */
-               if (hrtimer_try_to_cancel(timer) < 0) {
-                       spin_unlock_irq(&tsk->sighand->siglock);
-                       goto again;
-               }
                if (ovalue) {
                        ovalue->it_value = itimer_get_remtime(timer);
                        ovalue->it_interval
                                = ktime_to_timeval(tsk->signal->it_real_incr);
                }
+               /* We are sharing ->siglock with it_real_fn() */
+               if (hrtimer_try_to_cancel(timer) < 0) {
+                       spin_unlock_irq(&tsk->sighand->siglock);
+                       goto again;
+               }
                tsk->signal->it_real_incr =
                        timeval_to_ktime(value->it_interval);
                expires = timeval_to_ktime(value->it_value);