Commit b9eb1ee0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: Nfsdv4 pointer cleanup

From: NeilBrown <neilb@cse.unsw.edu.au>

From: "William A.(Andy) Adamson" <andros@citi.umich.edu>

Compare inode pointers instead of dentry pointers when checking an inode
refered to by a stateid against an inode refered to by a file handle.

Set st_vfs_set to 0 if the stateid/file handle check fails to avoid
referencing bad state when reaping stateid's.
parent c85705ed
......@@ -1304,7 +1304,8 @@ find_openstateowner_id(u32 st_id) {
static inline int
nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
{
return (fhp->fh_dentry != stp->st_vfs_file.f_dentry);
return (stp->st_vfs_set == 0 ||
fhp->fh_dentry->d_inode != stp->st_vfs_file.f_dentry->d_inode);
}
static int
......@@ -1347,6 +1348,7 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl
}
if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) {
dprintk("NFSD: preprocess_stateid_op: fh-stateid mismatch!\n");
stp->st_vfs_set = 0;
goto out;
}
if (!stp->st_stateowner->so_confirmed) {
......@@ -1415,6 +1417,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) {
printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n");
stp->st_vfs_set = 0;
goto out;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment