diff options
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index d87d354ec424..c502c60e4f54 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -184,7 +184,11 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) | |||
184 | int ufd; | 184 | int ufd; |
185 | struct timerfd_ctx *ctx; | 185 | struct timerfd_ctx *ctx; |
186 | 186 | ||
187 | if (flags) | 187 | /* Check the TFD_* constants for consistency. */ |
188 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | ||
189 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | ||
190 | |||
191 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | ||
188 | return -EINVAL; | 192 | return -EINVAL; |
189 | if (clockid != CLOCK_MONOTONIC && | 193 | if (clockid != CLOCK_MONOTONIC && |
190 | clockid != CLOCK_REALTIME) | 194 | clockid != CLOCK_REALTIME) |
@@ -198,7 +202,8 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) | |||
198 | ctx->clockid = clockid; | 202 | ctx->clockid = clockid; |
199 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); | 203 | hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS); |
200 | 204 | ||
201 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx); | 205 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
206 | flags & (O_CLOEXEC | O_NONBLOCK)); | ||
202 | if (ufd < 0) | 207 | if (ufd < 0) |
203 | kfree(ctx); | 208 | kfree(ctx); |
204 | 209 | ||