diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-11-03 08:00:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-03 17:39:07 +0100 |
commit | 3bd364d156b13a7f5ba6fd5892b1a4439aa1666b (patch) | |
tree | 614125c910e7afe002c7548682b85d08090d9f8f /fs/nfsd | |
parent | 5f71ff51063177085e7dc2eb33913a2a222700ad (diff) | |
download | linux-stable-3bd364d156b13a7f5ba6fd5892b1a4439aa1666b.tar.gz linux-stable-3bd364d156b13a7f5ba6fd5892b1a4439aa1666b.tar.bz2 linux-stable-3bd364d156b13a7f5ba6fd5892b1a4439aa1666b.zip |
nfsd: Ensure we check stateid validity in the seqid operation checks
[ Upstream commit 9271d7e509c1bfc0b9a418caec29ec8d1ac38270 ]
After taking the stateid st_mutex, we want to know that the stateid
still represents valid state before performing any non-idempotent
actions.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 61f38346ce9d..15343dd6e415 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -5180,15 +5180,9 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ status = nfsd4_check_seqid(cstate, sop, seqid); if (status) return status; - if (stp->st_stid.sc_type == NFS4_CLOSED_STID - || stp->st_stid.sc_type == NFS4_REVOKED_DELEG_STID) - /* - * "Closed" stateid's exist *only* to return - * nfserr_replay_me from the previous step, and - * revoked delegations are kept only for free_stateid. - */ - return nfserr_bad_stateid; - mutex_lock(&stp->st_mutex); + status = nfsd4_lock_ol_stateid(stp); + if (status != nfs_ok) + return status; status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); if (status == nfs_ok) status = nfs4_check_fh(current_fh, &stp->st_stid); |