nfs_lookup_revalidate(): fix a leak
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 30 Nov 2012 03:04:36 +0000 (22:04 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 30 Nov 2012 03:04:36 +0000 (22:04 -0500)
We are leaking fattr and fhandle if we decide that dentry is not to
be invalidated, after all (e.g. happens to be a mountpoint).  Just
free both before that...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/nfs/dir.c

index 99489cfca24d29b6f160aa46b69aff82d2d61094..b9e66b7e0c1495ba05c1fb6a4b2f1557ca6a9b24 100644 (file)
@@ -1101,6 +1101,8 @@ out_set_verifier:
 out_zap_parent:
        nfs_zap_caches(dir);
  out_bad:
+       nfs_free_fattr(fattr);
+       nfs_free_fhandle(fhandle);
        nfs_mark_for_revalidate(dir);
        if (inode && S_ISDIR(inode->i_mode)) {
                /* Purge readdir caches. */
@@ -1113,8 +1115,6 @@ out_zap_parent:
                shrink_dcache_parent(dentry);
        }
        d_drop(dentry);
-       nfs_free_fattr(fattr);
-       nfs_free_fhandle(fhandle);
        dput(parent);
        dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n",
                        __func__, dentry->d_parent->d_name.name,