diff options
author | John Stultz <john.stultz@linaro.org> | 2011-08-10 13:26:09 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2011-08-10 13:26:09 -0400 |
commit | 6af7e471e5a7746b8024d70b4363d3dfe41d36b8 (patch) | |
tree | 33b1af81dfadefcc367307939acbb0d28c07c7c1 /kernel/time | |
parent | ea7802f630d356acaf66b3c0b28c00a945fc35dc (diff) |
alarmtimers: Avoid possible denial of service with high freq periodic timers
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>
CC: stable@kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/alarmtimer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 0e9263f6fd09..ea5e1a928d5b 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, | |||
481 | if (!rtcdev) | 481 | if (!rtcdev) |
482 | return -ENOTSUPP; | 482 | return -ENOTSUPP; |
483 | 483 | ||
484 | /* | ||
485 | * XXX HACK! Currently we can DOS a system if the interval | ||
486 | * period on alarmtimers is too small. Cap the interval here | ||
487 | * to 100us and solve this properly in a future patch! -jstultz | ||
488 | */ | ||
489 | if ((new_setting->it_interval.tv_sec == 0) && | ||
490 | (new_setting->it_interval.tv_nsec < 100000)) | ||
491 | new_setting->it_interval.tv_nsec = 100000; | ||
492 | |||
484 | if (old_setting) | 493 | if (old_setting) |
485 | alarm_timer_get(timr, old_setting); | 494 | alarm_timer_get(timr, old_setting); |
486 | 495 | ||