Commit 9f907c01 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] Fix timeout overflow with jiffies

Prevent timeout overflow if timer ticks are behind jiffies (due to high
softirq load or due to dyntick), by limiting the valid timeout range to
MAX_LONG/2.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 41cf5445
...@@ -142,13 +142,13 @@ static inline u64 get_jiffies_64(void) ...@@ -142,13 +142,13 @@ static inline u64 get_jiffies_64(void)
* *
* And some not so obvious. * And some not so obvious.
* *
* Note that we don't want to return MAX_LONG, because * Note that we don't want to return LONG_MAX, because
* for various timeout reasons we often end up having * for various timeout reasons we often end up having
* to wait "jiffies+1" in order to guarantee that we wait * to wait "jiffies+1" in order to guarantee that we wait
* at _least_ "jiffies" - so "jiffies+1" had better still * at _least_ "jiffies" - so "jiffies+1" had better still
* be positive. * be positive.
*/ */
#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) #define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1)
/* /*
* We want to do realistic conversions of time so we need to use the same * We want to do realistic conversions of time so we need to use the same
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment