aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-06-07 21:53:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-06-07 21:53:51 -0400
commita01e718f7241c53f564402f7acff373eed5bd166 (patch)
treecea10fecfae5e081e954861905c25a7f22143444
parent3d56c25e3bb0726a5c5e16fc2d9e38f8ed763085 (diff)
fix a regression in atomic_open()
open("/foo/no_such_file", O_RDONLY | O_CREAT) on should fail with EACCES when /foo is not writable; failing with ENOENT is obviously wrong. That got broken by a braino introduced when moving the creat_error logics from atomic_open() to lookup_open(). Easy to fix, fortunately. Spotted-by: "Yan, Zheng" <ukernel@gmail.com> Tested-by: "Yan, Zheng" <ukernel@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d7c0cac56d89..28cb1cd8507c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2995,9 +2995,13 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
2995 } 2995 }
2996 if (*opened & FILE_CREATED) 2996 if (*opened & FILE_CREATED)
2997 fsnotify_create(dir, dentry); 2997 fsnotify_create(dir, dentry);
2998 path->dentry = dentry; 2998 if (unlikely(d_is_negative(dentry))) {
2999 path->mnt = nd->path.mnt; 2999 error = -ENOENT;
3000 return 1; 3000 } else {
3001 path->dentry = dentry;
3002 path->mnt = nd->path.mnt;
3003 return 1;
3004 }
3001 } 3005 }
3002 } 3006 }
3003 dput(dentry); 3007 dput(dentry);