aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2011-08-10 10:26:09 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-03 11:40:07 -0700
commitc3a44b4d23f4cb1b3eafb8c2c74d88f452d50a6d (patch)
tree1ae49d74350fd3febbc73b1516924bc7faed7e7d /kernel/time
parent0898dd1603e1dec711217b85329c031b30f81710 (diff)
downloadkernel_samsung_smdk4412-c3a44b4d23f4cb1b3eafb8c2c74d88f452d50a6d.zip
kernel_samsung_smdk4412-c3a44b4d23f4cb1b3eafb8c2c74d88f452d50a6d.tar.gz
kernel_samsung_smdk4412-c3a44b4d23f4cb1b3eafb8c2c74d88f452d50a6d.tar.bz2
alarmtimers: Avoid possible denial of service with high freq periodic timers
commit 6af7e471e5a7746b8024d70b4363d3dfe41d36b8 upstream. Its possible to jam up the alarm timers by setting very small interval timers, which will cause the alarmtimer subsystem to spend all of its time firing and restarting timers. This can effectivly lock up a box. A deeper fix is needed, closely mimicking the hrtimer code, but for now just cap the interval to 100us to avoid userland hanging the system. CC: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/alarmtimer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 0e9263f..ea5e1a9 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -481,6 +481,15 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,
if (!rtcdev)
return -ENOTSUPP;
+ /*
+ * 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);