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
This commit is contained in:
commit
8a9172356f
|
@ -400,9 +400,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
|
||||||
clockid != CLOCK_BOOTTIME_ALARM))
|
clockid != CLOCK_BOOTTIME_ALARM))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!capable(CAP_WAKE_ALARM) &&
|
if ((clockid == CLOCK_REALTIME_ALARM ||
|
||||||
(clockid == CLOCK_REALTIME_ALARM ||
|
clockid == CLOCK_BOOTTIME_ALARM) &&
|
||||||
clockid == CLOCK_BOOTTIME_ALARM))
|
!capable(CAP_WAKE_ALARM))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
|
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
|
||||||
|
@ -449,7 +449,7 @@ static int do_timerfd_settime(int ufd, int flags,
|
||||||
return ret;
|
return ret;
|
||||||
ctx = f.file->private_data;
|
ctx = f.file->private_data;
|
||||||
|
|
||||||
if (!capable(CAP_WAKE_ALARM) && isalarm(ctx)) {
|
if (isalarm(ctx) && !capable(CAP_WAKE_ALARM)) {
|
||||||
fdput(f);
|
fdput(f);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ int register_refined_jiffies(long cycles_per_second)
|
||||||
shift_hz += cycles_per_tick/2;
|
shift_hz += cycles_per_tick/2;
|
||||||
do_div(shift_hz, cycles_per_tick);
|
do_div(shift_hz, cycles_per_tick);
|
||||||
/* Calculate nsec_per_tick using shift_hz */
|
/* 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;
|
nsec_per_tick += (u32)shift_hz/2;
|
||||||
do_div(nsec_per_tick, (u32)shift_hz);
|
do_div(nsec_per_tick, (u32)shift_hz);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue