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 <marc.c.dionne@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
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();
crfree(credp);
}
+ dput(parent);
+
return;
}