alarmtimer: Rate limit periodic intervals
[pandora-kernel.git] / kernel / time / alarmtimer.c
index 9c53e04..c82900c 100644 (file)
@@ -598,6 +598,14 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
 
        /* start the timer */
        timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval);
+
+       /*
+        * Rate limit to the tick as a hot fix to prevent DOS. Will be
+        * mopped up later.
+        */
+       if (ktime_to_ns(timr->it.alarm.interval) < TICK_NSEC)
+               timr->it.alarm.interval = ktime_set(1, 0);
+
        exp = timespec_to_ktime(new_setting->it_value);
        /* Convert (if necessary) to absolute time */
        if (flags != TIMER_ABSTIME) {