From 58837dbc56251cf640ad46273c534b71f4fc40e3 Mon Sep 17 00:00:00 2001 From: Chaskiel Grundman Date: Mon, 6 Dec 2010 12:43:12 -0500 Subject: [PATCH] linux: avoid leaking parent when revalidating and it is /afs 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 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index c13bfd9..6b4a791 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -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(); -- 1.9.4