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>

authored by Ian Kent and committed by Al Viro 89312214 c14cc63a

+3 -1
+3 -1
fs/namei.c
··· 1272 1272 path->mnt = mnt; 1273 1273 path->dentry = dentry; 1274 1274 err = follow_managed(path, nd->flags); 1275 - if (unlikely(err < 0)) 1275 + if (unlikely(err < 0)) { 1276 + path_put_conditional(path, nd); 1276 1277 return err; 1278 + } 1277 1279 *inode = path->dentry->d_inode; 1278 1280 return 0; 1279 1281