From dcb22c4f8e7403f9af2b9d910425c5552f94f014 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 14 Feb 2008 00:58:36 +0100 Subject: [PATCH] --- yaml --- r: 85515 b: refs/heads/master c: 63070a79ba482c274bad10ac8c4b587a3e011f2c h: refs/heads/master i: 85513: 1885db8f8fe1c1623c87ea2997cd1ad6397f2d2e 85511: 95d607b47eb1b1981bedeb807133ab36360834c4 v: v3 --- [refs] | 2 +- trunk/kernel/hrtimer.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f81b986c647c..e40496e36e66 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a7780e725d1bb4c3094fcc12f1c5c5faea1e988 +refs/heads/master: 63070a79ba482c274bad10ac8c4b587a3e011f2c diff --git a/trunk/kernel/hrtimer.c b/trunk/kernel/hrtimer.c index c2893af9479e..98bee013f71f 100644 --- a/trunk/kernel/hrtimer.c +++ b/trunk/kernel/hrtimer.c @@ -442,6 +442,8 @@ static int hrtimer_reprogram(struct hrtimer *timer, ktime_t expires = ktime_sub(timer->expires, base->offset); int res; + WARN_ON_ONCE(timer->expires.tv64 < 0); + /* * When the callback is running, we do not reprogram the clock event * device. The timer callback is either running on a different CPU or @@ -452,6 +454,15 @@ static int hrtimer_reprogram(struct hrtimer *timer, if (hrtimer_callback_running(timer)) return 0; + /* + * CLOCK_REALTIME timer might be requested with an absolute + * expiry time which is less than base->offset. Nothing wrong + * about that, just avoid to call into the tick code, which + * has now objections against negative expiry values. + */ + if (expires.tv64 < 0) + return -ETIME; + if (expires.tv64 >= expires_next->tv64) return 0;