Skip to contentSkip to conversation

Patch "timers: Fix overflow in get_next_timer_interrupt" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 7, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

timers: Fix overflow in get_next_timer_interrupt

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
timers-fix-overflow-in-get_next_timer_interrupt.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 34f41c0316ed52b0b44542491d89278efdaa70e4 Mon Sep 17 00:00:00 2001

From: Matija Glavinic Pecotic <[email protected]>
Date: Tue, 1 Aug 2017 09:11:52 +0200
Subject: timers: Fix overflow in get_next_timer_interrupt

From: Matija Glavinic Pecotic <[email protected]>

commit 34f41c0316ed52b0b44542491d89278efdaa70e4 upstream.

For e.g. HZ=100, timer being 430 jiffies in the future, and 32 bit unsigned int, there is an overflow on unsigned int right-hand side of the expression which results with wrong values being returned.

Type cast the multiplier to 64bit to avoid that issue.

---
 kernel/time/timer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/timer.c +1 -1
@@ -1536,7 +1536,7 @@ u64 get_next_timer_interrupt(unsigned lo
 		base->is_idle = false;
 	} else {
 		if (!is_max_delta)
-			expires = basem + (nextevt - basej) * TICK_NSEC;
+			expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
 		/*
 		 * If we expect to sleep more than a tick, mark the base idle:
 		 */

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/timers-fix-overflow-in-get_next_timer_interrupt.patch