Commit d57c0477 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

do_last(): ELOOP failure exit should be done after leaving RCU mode

commit 5129fa48 upstream.

... or we risk seeing a bogus value of d_is_symlink() there.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f4b352f
...@@ -3149,11 +3149,6 @@ static int do_last(struct nameidata *nd, ...@@ -3149,11 +3149,6 @@ static int do_last(struct nameidata *nd,
if (unlikely(error)) if (unlikely(error))
return error; return error;
if (unlikely(d_is_symlink(path.dentry)) && !(open_flag & O_PATH)) {
path_to_nameidata(&path, nd);
return -ELOOP;
}
if ((nd->flags & LOOKUP_RCU) || nd->path.mnt != path.mnt) { if ((nd->flags & LOOKUP_RCU) || nd->path.mnt != path.mnt) {
path_to_nameidata(&path, nd); path_to_nameidata(&path, nd);
} else { } else {
...@@ -3172,6 +3167,10 @@ static int do_last(struct nameidata *nd, ...@@ -3172,6 +3167,10 @@ static int do_last(struct nameidata *nd,
return error; return error;
} }
audit_inode(nd->name, nd->path.dentry, 0); audit_inode(nd->name, nd->path.dentry, 0);
if (unlikely(d_is_symlink(nd->path.dentry)) && !(open_flag & O_PATH)) {
error = -ELOOP;
goto out;
}
error = -EISDIR; error = -EISDIR;
if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry)) if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry))
goto out; goto out;
......
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