summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2006-02-01 12:05:09 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-01 17:53:12 +0100
commita16a1c095a2392d49fafea22f3a508e268ef7167 (patch)
treeee5da8c9f04fe03eac9ab399b00f089748a74ddd
parent[PATCH] hrtimers: fix possible use of NULL pointer in posix-timers (diff)
downloadlinux-a16a1c095a2392d49fafea22f3a508e268ef7167.tar.xz
linux-a16a1c095a2392d49fafea22f3a508e268ef7167.zip
[PATCH] hrtimers: fix oldvalue return in setitimer
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>
-rw-r--r--kernel/itimer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 6433d0685506..379be2f8c84c 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -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);