Commit 92f63cd000059366af18712367216d96180e0ec0
Committed by
Linus Torvalds
1 parent
0662b71322
Exists in
master
and in
20 other branches
[PATCH] s390: next_timer_interrupt overflow in stop_hz_timer
The 32 bit unsigned substraction (next - jiffies) in stop_hz_timer can overflow if jiffies gets advanced between next_timer_interrupt and the read under the xtime lock. The cast to a u64 then results in a large value which causes the cpu to wait too long. Fix this by casting next and jiffies independently to u64 before subtracting them. (Spotted by Zachary Amsden <zach@vmware.com>) Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
arch/s390/kernel/time.c
... | ... | @@ -272,7 +272,7 @@ |
272 | 272 | next = next_timer_interrupt(); |
273 | 273 | do { |
274 | 274 | seq = read_seqbegin_irqsave(&xtime_lock, flags); |
275 | - timer = (__u64)(next - jiffies) + jiffies_64; | |
275 | + timer = (__u64 next) - (__u64 jiffies) + jiffies_64; | |
276 | 276 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
277 | 277 | todval = -1ULL; |
278 | 278 | /* Be careful about overflows. */ |