blob: 7c8a5e5407890bb5acd926022baf3ea3e5165ce8 [file] [log] [blame]
From 43aa22ec4ce74da717a65e1dc12b485150eb678a Mon Sep 17 00:00:00 2001
From: Aleksa Sarai <>
Date: Sat, 7 Dec 2019 01:13:26 +1100
Subject: [PATCH] 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
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" <>
Fixes: 397d425dc26d ("vfs: Test for and handle paths that are unreachable from their mnt_root")
Suggested-by: Al Viro <>
Signed-off-by: Aleksa Sarai <>
Signed-off-by: Al Viro <>
Signed-off-by: Paul Gortmaker <>
diff --git a/fs/namei.c b/fs/namei.c
index 797cacb8fdcd..3508a571d042 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1366,7 +1366,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;
} else {
struct mount *mnt = real_mount(nd->path.mnt);