diff options
author | Colin Cross <ccross@android.com> | 2011-10-27 15:03:56 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-10-27 15:03:56 -0700 |
commit | 60988eca1376ba564e778007cbffabebf05599e1 (patch) | |
tree | a188cdd22dc3a9d42955679dc01357bcd0d7e264 /kernel/time | |
parent | 47d998a7cec61a44b9e0799301039a63fed28280 (diff) | |
parent | bc2e7067af4c1cd074aaec71c2982e2265f7f169 (diff) | |
download | kernel_samsung_espresso10-60988eca1376ba564e778007cbffabebf05599e1.zip kernel_samsung_espresso10-60988eca1376ba564e778007cbffabebf05599e1.tar.gz kernel_samsung_espresso10-60988eca1376ba564e778007cbffabebf05599e1.tar.bz2 |
Merge branch 'linux-omap-3.0' into android-omap-3.0
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/alarmtimer.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 59f369f..ea5e1a9 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -441,6 +441,8 @@ static int alarm_timer_create(struct k_itimer *new_timer) static void alarm_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) { + memset(cur_setting, 0, sizeof(struct itimerspec)); + cur_setting->it_interval = ktime_to_timespec(timr->it.alarmtimer.period); cur_setting->it_value = @@ -479,11 +481,17 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, if (!rtcdev) return -ENOTSUPP; - /* Save old values */ - old_setting->it_interval = - ktime_to_timespec(timr->it.alarmtimer.period); - old_setting->it_value = - ktime_to_timespec(timr->it.alarmtimer.node.expires); + /* + * XXX HACK! Currently we can DOS a system if the interval + * period on alarmtimers is too small. Cap the interval here + * to 100us and solve this properly in a future patch! -jstultz + */ + if ((new_setting->it_interval.tv_sec == 0) && + (new_setting->it_interval.tv_nsec < 100000)) + new_setting->it_interval.tv_nsec = 100000; + + if (old_setting) + alarm_timer_get(timr, old_setting); /* If the timer was already set, cancel it */ alarm_cancel(&timr->it.alarmtimer); |