Commit a16a1c095a2392d49fafea22f3a508e268ef7167
Committed by
Linus Torvalds
1 parent
b6557fbca8
Exists in
master
and in
39 other branches
[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>
Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff
kernel/itimer.c
... | ... | @@ -155,15 +155,15 @@ |
155 | 155 | again: |
156 | 156 | spin_lock_irq(&tsk->sighand->siglock); |
157 | 157 | 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 | - } | |
163 | 158 | if (ovalue) { |
164 | 159 | ovalue->it_value = itimer_get_remtime(timer); |
165 | 160 | ovalue->it_interval |
166 | 161 | = ktime_to_timeval(tsk->signal->it_real_incr); |
162 | + } | |
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 | 167 | } |
168 | 168 | tsk->signal->it_real_incr = |
169 | 169 | timeval_to_ktime(value->it_interval); |