From: Marc Dionne Date: Wed, 24 Apr 2013 13:11:09 +0000 (-0400) Subject: linux: Fix leaked dentry reference in the revalidate op X-Git-Tag: upstream/1.8.0_pre1^2~1155 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=50083ea0df9610d0c652931af58e013e7f494c19;p=packages%2Fo%2Fopenafs.git linux: Fix leaked dentry reference in the revalidate op In one error case, we exit the function without release the reference on the parent dentry. This dangling reference can cause an oops when the client is shut down. Change-Id: I1632b581f6e7a557bb54a999dc1837c31b8381bf Reviewed-on: http://gerrit.openafs.org/9802 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index cc6775d5f..ca7fe852b 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1134,6 +1134,7 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) code = afs_EvalFakeStat(&vcp, &fakestate, &treq); if ((tryEvalOnly && vcp->mvstat == 1) || code) { /* a mount point, not yet replaced by its directory */ + dput(parent); goto bad_dentry; } } @@ -1150,8 +1151,10 @@ afs_linux_dentry_revalidate(struct dentry *dp, int flags) * always require a crref() which would be "slow". */ if (vcp->last_looker != treq.uid) { - if (!afs_AccessOK(vcp, (vType(vcp) == VREG) ? PRSFS_READ : PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) + if (!afs_AccessOK(vcp, (vType(vcp) == VREG) ? PRSFS_READ : PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) { + dput(parent); goto bad_dentry; + } vcp->last_looker = treq.uid; }