mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
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 <[email protected]> Acked-by: Ingo Molnar <[email protected]> Tested-by: Frans Pop <[email protected]>
This commit is contained in:
parent
e760e716d4
commit
5a7780e725
5 changed files with 29 additions and 22 deletions
|
|
@ -767,9 +767,11 @@ common_timer_set(struct k_itimer *timr, int flags,
|
|||
/* SIGEV_NONE timers are not queued ! See common_timer_get */
|
||||
if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) {
|
||||
/* Setup correct expiry time for relative timers */
|
||||
if (mode == HRTIMER_MODE_REL)
|
||||
timer->expires = ktime_add(timer->expires,
|
||||
timer->base->get_time());
|
||||
if (mode == HRTIMER_MODE_REL) {
|
||||
timer->expires =
|
||||
ktime_add_safe(timer->expires,
|
||||
timer->base->get_time());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue