X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Fhrtimer.c;h=98bee013f71f036805618cb75ee55a7b8d92a9e6;hb=320787c75ccac3189a1b7aae81f0efc1055f6d3a;hp=c2893af9479e6812e33ae14f97fac7f9a4b8afd7;hpb=5a7780e725d1bb4c3094fcc12f1c5c5faea1e988;p=linux-2.6 diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c2893af947..98bee013f7 100644 --- a/kernel/hrtimer.c +++ b/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;