diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-02-13 03:20:43 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-02-14 16:08:30 -0500 |
commit | 5a7780e725d1bb4c3094fcc12f1c5c5faea1e988 (patch) | |
tree | 50fc5cde427f3854d0b84ba1037fef3fb4693e11 /kernel/posix-timers.c | |
parent | e760e716d47b48caf98da348368fd41b4a9b9e7e (diff) |
hrtimer: check relative timeouts for overflow
Various user space callers ask for relative timeouts. While we fixed
that overflow issue in hrtimer_start(), the sites which convert
relative user space values to absolute timeouts themself were uncovered.
Instead of putting overflow checks into each place add a function
which does the sanity checking and convert all affected callers to use
it.
Thanks to Frans Pop, who reported the problem and tested the fixes.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Tested-by: Frans Pop <elendil@planet.nl>
Diffstat (limited to 'kernel/posix-timers.c')
-rw-r--r-- | kernel/posix-timers.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 022c9c3cee6f..a9b04203a66d 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -767,9 +767,11 @@ common_timer_set(struct k_itimer *timr, int flags, | |||
767 | /* SIGEV_NONE timers are not queued ! See common_timer_get */ | 767 | /* SIGEV_NONE timers are not queued ! See common_timer_get */ |
768 | if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) { | 768 | if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) { |
769 | /* Setup correct expiry time for relative timers */ | 769 | /* Setup correct expiry time for relative timers */ |
770 | if (mode == HRTIMER_MODE_REL) | 770 | if (mode == HRTIMER_MODE_REL) { |
771 | timer->expires = ktime_add(timer->expires, | 771 | timer->expires = |
772 | timer->base->get_time()); | 772 | ktime_add_safe(timer->expires, |
773 | timer->base->get_time()); | ||
774 | } | ||
773 | return 0; | 775 | return 0; |
774 | } | 776 | } |
775 | 777 | ||