From 165bd14126ea4ec2cf6563f865ab9d6bd7477d77 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Wed, 24 Mar 2010 16:48:35 +0000 Subject: [PATCH] Linux : Apply more dget_parent() pixie dust Replace another dentry->d_parent->d_inode lookup with a dget_parent() - accessing d_parent directly is potentially racy. Change-Id: I2c21cd6ef5c1b4b601c830836590705b397915e4 Reviewed-on: http://gerrit.openafs.org/1647 Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 2b26c2be72..9ebbfe1e50 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -735,8 +735,12 @@ static inline void check_bad_parent(struct dentry *dp) { cred_t *credp; - struct vcache *vcp = VTOAFS(dp->d_inode), *avc = NULL; - struct vcache *pvc = VTOAFS(dp->d_parent->d_inode); + struct dentry *parent; + struct vcache *vcp, *pvc, *avc = NULL; + + vcp = VTOAFS(dp->d_inode); + parent = dget_parent(dp); + pvc = VTOAFS(parent->d_inode); if (vcp->mvid->Fid.Volume != pvc->f.fid.Fid.Volume) { /* bad parent */ credp = crref(); @@ -754,6 +758,8 @@ check_bad_parent(struct dentry *dp) crfree(credp); } + dput(parent); + return; }