diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-02-28 03:37:37 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-02-28 03:37:37 +0300 |
commit | 5129fa482b16615fd4464d2f5d23acb1b7056c66 (patch) | |
tree | 1dc9ec48abbcaa87be322a795ca661444ec52acd /fs/namei.c | |
parent | a7f775428b8f5808815c0e3004020cedb94cbe3b (diff) | |
download | linux-5129fa482b16615fd4464d2f5d23acb1b7056c66.tar.xz |
do_last(): ELOOP failure exit should be done after leaving RCU mode
... or we risk seeing a bogus value of d_is_symlink() there.
Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index 65a0e9d1ea48..9c590e0f66e9 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3211,11 +3211,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 { @@ -3234,6 +3229,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; |