From: Thomas Gleixner Date: Tue, 26 Jul 2011 23:08:19 +0000 (-0700) Subject: rtc: limit frequency X-Git-Tag: firefly_0821_release~7541^2~3108 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ec054bbddbd0841174f4d5c3a4685eca9f9a9f93;p=firefly-linux-kernel-4.4.55.git rtc: limit frequency commit 431e2bcc371016824f419baa745f82388258f3ee upstream. 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 0900dfea3ae7..3195dbd3ec34 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -708,7 +708,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; retry: spin_lock_irqsave(&rtc->irq_task_lock, flags);