Commit 89312214 authored by Ian Kent's avatar Ian Kent Committed by Al Viro

vfs - fix dentry ref count in do_lookup()

There is a ref count problem in fs/namei.c:do_lookup().

When walking in ref-walk mode, if follow_managed() returns a fail we
need to drop dentry and possibly vfsmount.  Clean up properly,
as we do in the other caller of follow_managed().
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c14cc63a
...@@ -1272,8 +1272,10 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, ...@@ -1272,8 +1272,10 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
path->mnt = mnt; path->mnt = mnt;
path->dentry = dentry; path->dentry = dentry;
err = follow_managed(path, nd->flags); err = follow_managed(path, nd->flags);
if (unlikely(err < 0)) if (unlikely(err < 0)) {
path_put_conditional(path, nd);
return err; return err;
}
*inode = path->dentry->d_inode; *inode = path->dentry->d_inode;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment