summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-02-27 19:37:37 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-03 15:07:30 -0800
commitd57c0477f842af4fdcfa93454bc2ad94d73b7158 (patch)
tree7c7a722bb7eaaa0c6528f8f008a46621c3a8cc10 /fs
parent6f4b352f004c696439c5b5d75a4edc3d0823e770 (diff)
do_last(): ELOOP failure exit should be done after leaving RCU mode
commit 5129fa482b16615fd4464d2f5d23acb1b7056c66 upstream. ... or we risk seeing a bogus value of d_is_symlink() there. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 930b51d6308b..d8ee4da93650 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3149,11 +3149,6 @@ finish_lookup:
if (unlikely(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) {
path_to_nameidata(&path, nd);
} else {
@@ -3172,6 +3167,10 @@ finish_open:
return error;
}
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;
if ((open_flag & O_CREAT) && d_is_dir(nd->path.dentry))
goto out;