diff options
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index 6a123b8ff3f5..b042bd7034b1 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | 186 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); |
187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | 187 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); |
188 | 188 | ||
189 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | 189 | if ((flags & ~TFD_CREATE_FLAGS) || |
190 | return -EINVAL; | 190 | (clockid != CLOCK_MONOTONIC && |
191 | if (clockid != CLOCK_MONOTONIC && | 191 | clockid != CLOCK_REALTIME)) |
192 | clockid != CLOCK_REALTIME) | ||
193 | return -EINVAL; | 192 | return -EINVAL; |
194 | 193 | ||
195 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); | 194 | ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); |
@@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
201 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 200 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
202 | 201 | ||
203 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 202 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
204 | flags & (O_CLOEXEC | O_NONBLOCK)); | 203 | flags & TFD_SHARED_FCNTL_FLAGS); |
205 | if (ufd < 0) | 204 | if (ufd < 0) |
206 | kfree(ctx); | 205 | kfree(ctx); |
207 | 206 | ||
@@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags, | |||
219 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) | 218 | if (copy_from_user(&ktmr, utmr, sizeof(ktmr))) |
220 | return -EFAULT; | 219 | return -EFAULT; |
221 | 220 | ||
222 | if (!timespec_valid(&ktmr.it_value) || | 221 | if ((flags & ~TFD_SETTIME_FLAGS) || |
222 | !timespec_valid(&ktmr.it_value) || | ||
223 | !timespec_valid(&ktmr.it_interval)) | 223 | !timespec_valid(&ktmr.it_interval)) |
224 | return -EINVAL; | 224 | return -EINVAL; |
225 | 225 | ||