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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Thomas Gleixner:
"A single fix for a long standing issue in the alarm timer subsystem,
which was noticed recently when people finally started to use alarm
timers for serious work"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
alarmtimer: Fix bug where relative alarm timers were treated as absolute

+18 -2
+18 -2
kernel/time/alarmtimer.c
··· 585 585 struct itimerspec *new_setting, 586 586 struct itimerspec *old_setting) 587 587 { 588 + ktime_t exp; 589 + 588 590 if (!rtcdev) 589 591 return -ENOTSUPP; 592 + 593 + if (flags & ~TIMER_ABSTIME) 594 + return -EINVAL; 590 595 591 596 if (old_setting) 592 597 alarm_timer_get(timr, old_setting); ··· 602 597 603 598 /* start the timer */ 604 599 timr->it.alarm.interval = timespec_to_ktime(new_setting->it_interval); 605 - alarm_start(&timr->it.alarm.alarmtimer, 606 - timespec_to_ktime(new_setting->it_value)); 600 + exp = timespec_to_ktime(new_setting->it_value); 601 + /* Convert (if necessary) to absolute time */ 602 + if (flags != TIMER_ABSTIME) { 603 + ktime_t now; 604 + 605 + now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime(); 606 + exp = ktime_add(now, exp); 607 + } 608 + 609 + alarm_start(&timr->it.alarm.alarmtimer, exp); 607 610 return 0; 608 611 } 609 612 ··· 742 729 743 730 if (!alarmtimer_get_rtcdev()) 744 731 return -ENOTSUPP; 732 + 733 + if (flags & ~TIMER_ABSTIME) 734 + return -EINVAL; 745 735 746 736 if (!capable(CAP_WAKE_ALARM)) 747 737 return -EPERM;