aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-04-03 16:49:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2021-04-07 13:57:17 -0400
commit7962c7d196e36aa597fadb78c1cb4fe7e209f803 (patch)
tree84f59052df80a9436d7dc018ad8c3017f6df2ea3 /fs/namei.c
parentteach set_nameidata() to handle setting the root as well (diff)
downloadlinux-dev-7962c7d196e36aa597fadb78c1cb4fe7e209f803.tar.xz
linux-dev-7962c7d196e36aa597fadb78c1cb4fe7e209f803.zip
namei: make sure nd->depth is always valid
Zero it in set_nameidata() rather than in path_init(). That way it always matches the number of valid nd->stack[] entries. Since terminate_walk() does zero it (after having emptied the stack), we don't need to reinitialize it in subsequent path_init(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 40ffb249aa7f..d38b17ad604c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -581,6 +581,7 @@ static void __set_nameidata(struct nameidata *p, int dfd, struct filename *name)
{
struct nameidata *old = current->nameidata;
p->stack = p->internal;
+ p->depth = 0;
p->dfd = dfd;
p->name = name;
p->path.mnt = NULL;
@@ -2320,7 +2321,6 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
nd->flags = flags;
nd->state |= ND_JUMPED;
- nd->depth = 0;
nd->m_seq = __read_seqcount_begin(&mount_lock.seqcount);
nd->r_seq = __read_seqcount_begin(&rename_lock.seqcount);