Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: Limit RTC PIE frequency

The RTC pie hrtimer is self rearming. We really need to limit the
frequency to something sensible. Thus limit it to the 8192Hz max
value from the rtc man documentation

Cc: Willy Tarreau <w@1wt.eu>
Cc: stable@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[jstultz: slightly reworked to use RTC_MAX_FREQ value]
Signed-off-by: John Stultz <john.stultz@linaro.org>

authored by

Thomas Gleixner and committed by
John Stultz
6e7a333e 3c8bb90e

+4 -1
+1 -1
drivers/rtc/interface.c
··· 708 708 int err = 0; 709 709 unsigned long flags; 710 710 711 - if (freq <= 0) 711 + if (freq <= 0 || freq > RTC_MAX_FREQ) 712 712 return -EINVAL; 713 713 retry: 714 714 spin_lock_irqsave(&rtc->irq_task_lock, flags);
+3
include/linux/rtc.h
··· 97 97 #define RTC_AF 0x20 /* Alarm interrupt */ 98 98 #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ 99 99 100 + 101 + #define RTC_MAX_FREQ 8192 102 + 100 103 #ifdef __KERNEL__ 101 104 102 105 #include <linux/types.h>