Skip to content

Commit

Permalink
alarmtimers: Avoid possible denial of service with high freq periodic…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
John Stultz committed Aug 10, 2011
1 parent ea7802f commit 6af7e47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/time/alarmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6af7e47

Please sign in to comment.