Skip to content

Commit 2b98149

Browse files
cypharAl Viro
authored andcommitted
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" <[email protected]> Fixes: 397d425 ("vfs: Test for and handle paths that are unreachable from their mnt_root") Suggested-by: Al Viro <[email protected]> Signed-off-by: Aleksa Sarai <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent e42617b commit 2b98149

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/namei.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
13651365
nd->path.dentry = parent;
13661366
nd->seq = seq;
13671367
if (unlikely(!path_connected(&nd->path)))
1368-
return -ENOENT;
1368+
return -ECHILD;
13691369
break;
13701370
} else {
13711371
struct mount *mnt = real_mount(nd->path.mnt);

0 commit comments

Comments
 (0)