aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksa Sarai2019-12-07 01:13:26 +1100
committerAl Viro2019-12-08 19:09:36 -0500
commit2b98149c2377bff12be5dd3ce02ae0506e2dd613 (patch)
tree95fb705a14f99ab1b6ca600a529a66c8793f7dcc
parente42617b825f8073569da76dc4510bfa019b1c35a (diff)
namei: only return -ECHILD from follow_dotdot_rcu()
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>
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d6c91d1e88cb..17ebaac2da49 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1365,7 +1365,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);