From: Chaskiel Grundman Date: Mon, 6 Dec 2010 17:43:12 +0000 (-0500) Subject: linux: avoid leaking parent when revalidating and it is /afs X-Git-Tag: upstream/1.8.0_pre1^2~4394 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=58837dbc56251cf640ad46273c534b71f4fc40e3;p=packages%2Fo%2Fopenafs.git 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 --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index c13bfd99d..6b4a7910b 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();