timer fixes
Subsystems (2)
Linus,
Please pull the latest timers-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus
# HEAD: fa3aa7a54fe6d3abf128f13cd4bbd40eaa48fed2 jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC
This includes a fix for lockups caused by incorrect nsecs related cleanup, and a capabilities check fix for timerfd.
Thanks,
Ingo
------------------>
Frederic Weisbecker (1):
jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC
Stephen Smalley (1):
timerfd: Only check CAP_WAKE_ALARM when it is needed
fs/timerfd.c | 8 ++++---- kernel/time/jiffies.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/timerfd.c +4 -4
@@ -400,9 +400,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) clockid != CLOCK_BOOTTIME_ALARM))return -EINVAL ; -if (!capable (CAP_WAKE_ALARM ) && - (clockid ==CLOCK_REALTIME_ALARM || - clockid ==CLOCK_BOOTTIME_ALARM )) +if ((clockid ==CLOCK_REALTIME_ALARM || + clockid ==CLOCK_BOOTTIME_ALARM ) && + !capable (CAP_WAKE_ALARM ))return -EPERM ; ctx =kzalloc (sizeof (*ctx),GFP_KERNEL );
@@ -449,7 +449,7 @@ static int do_timerfd_settime(int ufd, int flags,return ret; ctx = f.file->private_data; -if (!capable (CAP_WAKE_ALARM ) &&isalarm (ctx)) { +if (isalarm (ctx) && !capable (CAP_WAKE_ALARM )) {fdput (f);return -EPERM ; }
kernel/time/jiffies.c +1 -1
@@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second) shift_hz += cycles_per_tick/2 ;do_div (shift_hz, cycles_per_tick);/* Calculate nsec_per_tick using shift_hz */ - nsec_per_tick = (u64 )TICK_NSEC <<8 ; + nsec_per_tick = (u64 )NSEC_PER_SEC <<8 ; nsec_per_tick += (u32 )shift_hz/2 ;do_div (nsec_per_tick, (u32 )shift_hz);