From 50083ea0df9610d0c652931af58e013e7f494c19 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Wed, 24 Apr 2013 09:11:09 -0400 Subject: [PATCH] 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 --- src/afs/LINUX/osi_vnodeops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.39.5