Skip to content

Commit a16a1c0

Browse files
KAGA-KOKOLinus Torvalds
authored andcommitted
[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>
1 parent b6557fb commit a16a1c0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎kernel/itimer.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,16 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
155155
again:
156156
spin_lock_irq(&tsk->sighand->siglock);
157157
timer = &tsk->signal->real_timer;
158-
/* We are sharing ->siglock with it_real_fn() */
159-
if (hrtimer_try_to_cancel(timer) < 0) {
160-
spin_unlock_irq(&tsk->sighand->siglock);
161-
goto again;
162-
}
163158
if (ovalue) {
164159
ovalue->it_value = itimer_get_remtime(timer);
165160
ovalue->it_interval
166161
= ktime_to_timeval(tsk->signal->it_real_incr);
167162
}
163+
/* We are sharing ->siglock with it_real_fn() */
164+
if (hrtimer_try_to_cancel(timer) < 0) {
165+
spin_unlock_irq(&tsk->sighand->siglock);
166+
goto again;
167+
}
168168
tsk->signal->it_real_incr =
169169
timeval_to_ktime(value->it_interval);
170170
expires = timeval_to_ktime(value->it_value);

0 commit comments

Comments
 (0)