Skip to content

Commit 8a91723

Browse files
committed
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Ingo Molnar: "This includes a fix for lockups caused by incorrect nsecs related cleanup, and a capabilities check fix for timerfd" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC timerfd: Only check CAP_WAKE_ALARM when it is needed
2 parents 609b07b + fa3aa7a commit 8a91723

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fs/timerfd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
400400
clockid != CLOCK_BOOTTIME_ALARM))
401401
return -EINVAL;
402402

403-
if (!capable(CAP_WAKE_ALARM) &&
404-
(clockid == CLOCK_REALTIME_ALARM ||
405-
clockid == CLOCK_BOOTTIME_ALARM))
403+
if ((clockid == CLOCK_REALTIME_ALARM ||
404+
clockid == CLOCK_BOOTTIME_ALARM) &&
405+
!capable(CAP_WAKE_ALARM))
406406
return -EPERM;
407407

408408
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -449,7 +449,7 @@ static int do_timerfd_settime(int ufd, int flags,
449449
return ret;
450450
ctx = f.file->private_data;
451451

452-
if (!capable(CAP_WAKE_ALARM) && isalarm(ctx)) {
452+
if (isalarm(ctx) && !capable(CAP_WAKE_ALARM)) {
453453
fdput(f);
454454
return -EPERM;
455455
}

kernel/time/jiffies.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second)
125125
shift_hz += cycles_per_tick/2;
126126
do_div(shift_hz, cycles_per_tick);
127127
/* Calculate nsec_per_tick using shift_hz */
128-
nsec_per_tick = (u64)TICK_NSEC << 8;
128+
nsec_per_tick = (u64)NSEC_PER_SEC << 8;
129129
nsec_per_tick += (u32)shift_hz/2;
130130
do_div(nsec_per_tick, (u32)shift_hz);
131131

0 commit comments

Comments
 (0)