aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/hrtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r--kernel/hrtimer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index c2893af9479e..98bee013f71f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -442,6 +442,8 @@ static int hrtimer_reprogram(struct hrtimer *timer,
442 ktime_t expires = ktime_sub(timer->expires, base->offset); 442 ktime_t expires = ktime_sub(timer->expires, base->offset);
443 int res; 443 int res;
444 444
445 WARN_ON_ONCE(timer->expires.tv64 < 0);
446
445 /* 447 /*
446 * When the callback is running, we do not reprogram the clock event 448 * When the callback is running, we do not reprogram the clock event
447 * device. The timer callback is either running on a different CPU or 449 * device. The timer callback is either running on a different CPU or
@@ -452,6 +454,15 @@ static int hrtimer_reprogram(struct hrtimer *timer,
452 if (hrtimer_callback_running(timer)) 454 if (hrtimer_callback_running(timer))
453 return 0; 455 return 0;
454 456
457 /*
458 * CLOCK_REALTIME timer might be requested with an absolute
459 * expiry time which is less than base->offset. Nothing wrong
460 * about that, just avoid to call into the tick code, which
461 * has now objections against negative expiry values.
462 */
463 if (expires.tv64 < 0)
464 return -ETIME;
465
455 if (expires.tv64 >= expires_next->tv64) 466 if (expires.tv64 >= expires_next->tv64)
456 return 0; 467 return 0;
457 468