mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
@@ -581,6 +581,7 @@ static void __set_nameidata(struct nameidata *p, int dfd, struct filename *name)
|
|||||||
{
|
{
|
||||||
struct nameidata *old = current->nameidata;
|
struct nameidata *old = current->nameidata;
|
||||||
p->stack = p->internal;
|
p->stack = p->internal;
|
||||||
|
p->depth = 0;
|
||||||
p->dfd = dfd;
|
p->dfd = dfd;
|
||||||
p->name = name;
|
p->name = name;
|
||||||
p->path.mnt = NULL;
|
p->path.mnt = NULL;
|
||||||
@@ -2320,7 +2321,6 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
|
|||||||
|
|
||||||
nd->flags = flags;
|
nd->flags = flags;
|
||||||
nd->state |= ND_JUMPED;
|
nd->state |= ND_JUMPED;
|
||||||
nd->depth = 0;
|
|
||||||
|
|
||||||
nd->m_seq = __read_seqcount_begin(&mount_lock.seqcount);
|
nd->m_seq = __read_seqcount_begin(&mount_lock.seqcount);
|
||||||
nd->r_seq = __read_seqcount_begin(&rename_lock.seqcount);
|
nd->r_seq = __read_seqcount_begin(&rename_lock.seqcount);
|
||||||
|
Reference in New Issue
Block a user