linux: avoid leaking parent when revalidating and it is /afs
authorChaskiel Grundman <cg2v@andrew.cmu.edu>
Mon, 6 Dec 2010 17:43:12 +0000 (12:43 -0500)
committerDerrick Brashear <shadow@dementia.org>
Mon, 6 Dec 2010 18:45:39 +0000 (10:45 -0800)
we happily go to the "good dentry" path and exit, leaking the
result of dget_parent, if parent is globalVp. Let's not

Change-Id: I3848a1aa2611d17ba08e04b3f33f22623645d233
Reviewed-on: http://gerrit.openafs.org/3448
Reviewed-by: Chaskiel Grundman <cg2v@andrew.cmu.edu>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/afs/LINUX/osi_vnodeops.c

index c13bfd9..6b4a791 100644 (file)
@@ -825,13 +825,14 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags)
     afs_InitFakeStat(&fakestate);
 
     if (dp->d_inode) {
-       parent = dget_parent(dp);
-       pvcp = VTOAFS(parent->d_inode);
        vcp = VTOAFS(dp->d_inode);
 
        if (vcp == afs_globalVp)
            goto good_dentry;
 
+       parent = dget_parent(dp);
+       pvcp = VTOAFS(parent->d_inode);
+
        if ((vcp->mvstat == 1) || (vcp->mvstat == 2)) { /* need to lock */
            credp = crref();
            AFS_GLOCK();