Skip to content

Commit

Permalink
vfs - fix dentry ref count in do_lookup()
Browse files Browse the repository at this point in the history
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: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Ian Kent authored and Al Viro committed Jan 18, 2011
1 parent c14cc63 commit 8931221
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,10 @@ static int do_lookup(struct nameidata *nd, struct qstr *name,
path->mnt = mnt;
path->dentry = dentry;
err = follow_managed(path, nd->flags);
if (unlikely(err < 0))
if (unlikely(err < 0)) {
path_put_conditional(path, nd);
return err;
}
*inode = path->dentry->d_inode;
return 0;

Expand Down

0 comments on commit 8931221

Please sign in to comment.