Commit 6e7a333e authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

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: default avatarThomas Gleixner <tglx@linutronix.de>
[jstultz: slightly reworked to use RTC_MAX_FREQ value]
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 3c8bb90e
...@@ -708,7 +708,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) ...@@ -708,7 +708,7 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
int err = 0; int err = 0;
unsigned long flags; unsigned long flags;
if (freq <= 0) if (freq <= 0 || freq > RTC_MAX_FREQ)
return -EINVAL; return -EINVAL;
retry: retry:
spin_lock_irqsave(&rtc->irq_task_lock, flags); spin_lock_irqsave(&rtc->irq_task_lock, flags);
......
...@@ -97,6 +97,9 @@ struct rtc_pll_info { ...@@ -97,6 +97,9 @@ struct rtc_pll_info {
#define RTC_AF 0x20 /* Alarm interrupt */ #define RTC_AF 0x20 /* Alarm interrupt */
#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ #define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
#define RTC_MAX_FREQ 8192
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/types.h> #include <linux/types.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment