Commit 973d4b73 authored by Al Viro's avatar Al Viro

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8795e7d4
...@@ -3199,14 +3199,7 @@ static const char *do_last(struct nameidata *nd, ...@@ -3199,14 +3199,7 @@ static const char *do_last(struct nameidata *nd,
if (IS_ERR(dentry)) if (IS_ERR(dentry))
return ERR_CAST(dentry); return ERR_CAST(dentry);
if (file->f_mode & FMODE_OPENED) { if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) {
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) {
dput(nd->path.dentry); dput(nd->path.dentry);
nd->path.dentry = dentry; nd->path.dentry = dentry;
goto finish_open_created; goto finish_open_created;
...@@ -3230,7 +3223,9 @@ static const char *do_last(struct nameidata *nd, ...@@ -3230,7 +3223,9 @@ static const char *do_last(struct nameidata *nd,
error = complete_walk(nd); error = complete_walk(nd);
if (error) if (error)
return ERR_PTR(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 (open_flag & O_CREAT) {
if (d_is_dir(nd->path.dentry)) if (d_is_dir(nd->path.dentry))
return ERR_PTR(-EISDIR); return ERR_PTR(-EISDIR);
...@@ -3242,7 +3237,6 @@ static const char *do_last(struct nameidata *nd, ...@@ -3242,7 +3237,6 @@ static const char *do_last(struct nameidata *nd,
if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry)) if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
return ERR_PTR(-ENOTDIR); return ERR_PTR(-ENOTDIR);
finish_open_created:
do_truncate = false; do_truncate = false;
acc_mode = op->acc_mode; acc_mode = op->acc_mode;
if (file->f_mode & FMODE_CREATED) { if (file->f_mode & FMODE_CREATED) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment