From 431e2bcc371016824f419baa745f82388258f3ee Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 26 Jul 2011 16:08:19 -0700 Subject: [PATCH] rtc: limit frequency Due to the hrtimer self rearming mode a user can DoS the machine simply because it's starved by hrtimer events. The RTC hrtimer is self rearming. We really need to limit the frequency to something sensible. Signed-off-by: Thomas Gleixner Cc: John Stultz Cc: Ingo Molnar Cc: Ben Greear Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/rtc/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index b6bf57f25cc9..601b053bc0e5 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -688,7 +688,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) int err = 0; unsigned long flags; - if (freq <= 0) + if (freq <= 0 || freq > 5000) return -EINVAL; spin_lock_irqsave(&rtc->irq_task_lock, flags); -- 2.20.1