diff options
author | Ian Kent <raven@themaw.net> | 2011-01-18 05:06:10 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-18 07:21:26 +0100 |
commit | 8931221411f9ff950de8fd686dc5ab881394cb9a (patch) | |
tree | 63d97668bae62d1034002cc7778adde2aa18b346 /fs/namei.c | |
parent | autofs4 - fix get_next_positive_dentry() (diff) | |
download | linux-8931221411f9ff950de8fd686dc5ab881394cb9a.tar.xz linux-8931221411f9ff950de8fd686dc5ab881394cb9a.zip |
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: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r-- | fs/namei.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index b753192d8c3f..7d77f24d32a9 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1272,8 +1272,10 @@ done: 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; |