timer fixes for 3.1
Linus,
Please pull the latest timers-fixes-for-linus git tree from:
git://tesla.tglx.de/git/linux-2.6-tip.git timers-fixes-for-linus
Top commit sha1 on my devel machine is: 486257130873a2
Thanks,
tglx
------------------>
Axel Lin (1):
rtc: ep93xx: Fix 'rtc' may be used uninitialized warning
Ilkka Koskinen (1):
rtc: rtc-twl: Switch to using threaded irq
John Stultz (4):
alarmtimers: Avoid possible null pointer traversal
alarmtimers: Memset itimerspec passed into alarm_timer_get
alarmtimers: Avoid possible denial of service with high freq periodic timers
rtc: Fix RTC PIE frequency limit
Mike Waychison (1):
rtc: Initialized rtc_time->tm_isdst
Sebastian Reichel (1):
rtc: rtc-twl: Remove lockdep related local_irq_enable()
Todd Poynor (1):
rtc: twl: Fix registration vs. init order
drivers/rtc/interface.c | 2 +- drivers/rtc/rtc-ep93xx.c | 16 ++++++------ drivers/rtc/rtc-lib.c | 2 + drivers/rtc/rtc-twl.c | 60 ++++++++++++++++++--------------------------- include/linux/rtc.h | 3 ++ kernel/time/alarmtimer.c | 18 ++++++++++---- 6 files changed, 51 insertions(+), 50 deletions(-)
drivers/rtc/interface.c +1 -1
@@ -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 || freq >5000 ) +if (freq <=0 || freq >RTC_MAX_FREQ )return -EINVAL ; retry:spin_lock_irqsave (&rtc->irq_task_lock, flags);
drivers/rtc/rtc-ep93xx.c +8 -8
@@ -36,6 +36,7 @@*/ struct ep93xx_rtc {void __iomem *mmio_base; +struct rtc_device *rtc; }; static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload,
@@ -130,7 +131,6 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev) {struct ep93xx_rtc *ep93xx_rtc;struct resource *res; -struct rtc_device *rtc;int err; ep93xx_rtc =devm_kzalloc (&pdev->dev,sizeof (*ep93xx_rtc),GFP_KERNEL );
@@ -151,12 +151,12 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)return -ENXIO ; pdev->dev.platform_data = ep93xx_rtc; -platform_set_drvdata (pdev, rtc); +platform_set_drvdata (pdev, ep93xx_rtc); - rtc =rtc_device_register (pdev->name, + ep93xx_rtc->rtc =rtc_device_register (pdev->name, &pdev->dev, &ep93xx_rtc_ops,THIS_MODULE ); -if (IS_ERR (rtc)) { - err =PTR_ERR (rtc); +if (IS_ERR (ep93xx_rtc->rtc)) { + err =PTR_ERR (ep93xx_rtc->rtc); goto exit; }
@@ -167,7 +167,7 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)return 0 ; fail: -rtc_device_unregister (rtc); +rtc_device_unregister (ep93xx_rtc->rtc); exit:platform_set_drvdata (pdev,NULL ); pdev->dev.platform_data =NULL ;
@@ -176,11 +176,11 @@ exit: static int __exit ep93xx_rtc_remove(struct platform_device *pdev) { -struct rtc_device *rtc =platform_get_drvdata (pdev); +struct ep93xx_rtc *ep93xx_rtc =platform_get_drvdata (pdev);sysfs_remove_group (&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);platform_set_drvdata (pdev,NULL ); -rtc_device_unregister (rtc); +rtc_device_unregister (ep93xx_rtc->rtc); pdev->dev.platform_data =NULL ;return 0 ;
drivers/rtc/rtc-lib.c +2 -0
@@ -85,6 +85,8 @@ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) time -= tm->tm_hour *3600 ; tm->tm_min = time /60 ; tm->tm_sec = time - tm->tm_min *60 ; + + tm->tm_isdst =0 ; }EXPORT_SYMBOL (rtc_time_to_tm);
drivers/rtc/rtc-twl.c +24 -36
104 lines not on this page · raw message
include/linux/rtc.h +3 -0
@@ -97,6 +97,9 @@ struct rtc_pll_info {#define RTC_AF 0x20/* Alarm interrupt */ #define RTC_UF 0x10/* Update interrupt for 1Hz RTC */ + +#define RTC_MAX_FREQ 8192 +#ifdef __KERNEL__#include <linux/types.h>
kernel/time/alarmtimer.c +13 -5
@@ -441,6 +441,8 @@ static int alarm_timer_create(struct k_itimer *new_timer)static void alarm_timer_get (struct k_itimer *timr,struct itimerspec *cur_setting) { +memset (cur_setting,0 ,sizeof (struct itimerspec )); + cur_setting->it_interval =ktime_to_timespec (timr->it.alarmtimer.period); cur_setting->it_value =
@@ -479,11 +481,17 @@ static int alarm_timer_set(struct k_itimer *timr, int flags,if (!rtcdev)return -ENOTSUPP ; -/* Save old values */ - old_setting->it_interval = -ktime_to_timespec (timr->it.alarmtimer.period); - old_setting->it_value = -ktime_to_timespec (timr->it.alarmtimer.node.expires); +/* +* 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);/* If the timer was already set, cancel it */ alarm_cancel (&timr->it.alarmtimer);