summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-07-13 13:26:37 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-07-13 13:26:37 +0400
commitbb458c644a59dbba3a1fe59b27106c5e68e1c4bd (patch)
treeb0f3b51fc5cbd044b076cb0a1fec43ca62f2b7f5 /fs/open.c
parent4fbeb19d53cc3ef2da4bd1fd89a5dc9ac04add3a (diff)
Safer ABI for O_TMPFILE
[suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE; that will fail on old kernels in a lot more cases than what I came up with. And make sure O_CREAT doesn't get there... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index fca72c4d3f17..9156cb050d08 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -840,8 +840,8 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
if (flags & __O_SYNC)
flags |= O_DSYNC;
- if (flags & O_TMPFILE) {
- if (!(flags & O_CREAT))
+ if (flags & __O_TMPFILE) {
+ if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
return -EINVAL;
acc_mode = MAY_OPEN | ACC_MODE(flags);
} else if (flags & O_PATH) {