summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-01-26 18:48:16 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2020-03-14 04:09:13 +0300
commit973d4b73fbaf705f8fa5208234175606df0999e4 (patch)
tree776614afc041cb08183f3e5c935d3f46b0940e86 /fs/namei.c
parent8795e7d48288163ce29eb927240a0c32c40b4d54 (diff)
downloadlinux-973d4b73fbaf705f8fa5208234175606df0999e4.tar.xz
do_last(): rejoin the common path even earlier in FMODE_{OPENED,CREATED} case
... getting may_create_in_sticky() checks in FMODE_OPENED case as well. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 8cdf8ef41194..798672577367 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3199,14 +3199,7 @@ static const char *do_last(struct nameidata *nd,
if (IS_ERR(dentry))
return ERR_CAST(dentry);
- if (file->f_mode & FMODE_OPENED) {
- audit_inode(nd->name, file->f_path.dentry, 0);
- dput(nd->path.dentry);
- nd->path.dentry = dentry;
- goto finish_open_created;
- }
-
- if (file->f_mode & FMODE_CREATED) {
+ if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) {
dput(nd->path.dentry);
nd->path.dentry = dentry;
goto finish_open_created;
@@ -3230,7 +3223,9 @@ finish_open:
error = complete_walk(nd);
if (error)
return ERR_PTR(error);
- audit_inode(nd->name, nd->path.dentry, 0);
+finish_open_created:
+ if (!(file->f_mode & FMODE_CREATED))
+ audit_inode(nd->name, nd->path.dentry, 0);
if (open_flag & O_CREAT) {
if (d_is_dir(nd->path.dentry))
return ERR_PTR(-EISDIR);
@@ -3242,7 +3237,6 @@ finish_open:
if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
return ERR_PTR(-ENOTDIR);
-finish_open_created:
do_truncate = false;
acc_mode = op->acc_mode;
if (file->f_mode & FMODE_CREATED) {