summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksa Sarai <cyphar@cyphar.com>2019-12-07 01:13:26 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-05 16:43:48 +0100
commit8a7d7fa16150e66943383711817831eeb1b56e97 (patch)
treeab8e49d077b461d32fb8e8e049e0954a61b12fd5
parentc15a3d8f5eccc1f91a8dff7d0a282907e89e85a7 (diff)
namei: only return -ECHILD from follow_dotdot_rcu()
commit 2b98149c2377bff12be5dd3ce02ae0506e2dd613 upstream. It's over-zealous to return hard errors under RCU-walk here, given that a REF-walk will be triggered for all other cases handling ".." under RCU. The original purpose of this check was to ensure that if a rename occurs such that a directory is moved outside of the bind-mount which the resolution started in, it would be detected and blocked to avoid being able to mess with paths outside of the bind-mount. However, triggering a new REF-walk is just as effective a solution. Cc: "Eric W. Biederman" <ebiederm@xmission.com> Fixes: 397d425dc26d ("vfs: Test for and handle paths that are unreachable from their mnt_root") Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index bd1c0ca4151c..5b5759d70822 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1360,7 +1360,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
nd->path.dentry = parent;
nd->seq = seq;
if (unlikely(!path_connected(&nd->path)))
- return -ENOENT;
+ return -ECHILD;
break;
} else {
struct mount *mnt = real_mount(nd->path.mnt);