NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
Subsystems (2)
PATCH 1/1 NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>
Signed-off-by Jeff Layton <[email protected]>
--- fs/nfsd/nfs4state.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/nfsd/nfs4state.c +7 -3
@@ -3897,6 +3897,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, {__be32 status;struct nfs4_stid *s; +struct nfs4_ol_stateid *stp =NULL ;dprintk ("NFSD: %s: seqid=%d stateid = " STATEID_FMT "\n" , __func__, seqid,STATEID_VAL (stateid));
@@ -3906,11 +3907,14 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, cstate->minorversion, nn);if (status)return status; - *stpp =openlockstateid (s); + stp =openlockstateid (s);if (!nfsd4_has_session (cstate)) - cstate->replay_owner = (*stpp)->st_stateowner; + cstate->replay_owner = stp->st_stateowner; -return nfs4_seqid_op_checks (cstate, stateid, seqid, *stpp); + status =nfs4_seqid_op_checks (cstate, stateid, seqid, stp); +if (!status) + *stpp = stp; +return status; } static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
Signature · 1 line
1.9.3
Quoted 4 lines · Jeff Layton
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Jeff Layton <[email protected]>
The new code looks correct, but shouldn't callers already take care not to use the returned stateid only if nfs4_preprocess_seqid_op returns 0?
Quoted 10 lines · On Sat, 7 Jun 2014 07:08:00 -0700 Christoph Hellwig <[email protected]> wrote:
Quoted 4 lines · Jeff Layton
From: Trond Myklebust <[email protected]>
Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Jeff Layton <[email protected]>The new code looks correct, but shouldn't callers already take care not to use the returned stateid only if
nfs4_preprocess_seqid_opreturns 0?
Yeah, I mentioned that to Bruce on IRC. This is not really a bugfix, per-se, but more of a defensive coding measure.
Signature · 1 line
Jeff Layton <[email protected]>
Christoph Hellwig
Reviewed-byQuoted 2 lines · Jeff Layton
Yeah, I mentioned that to Bruce on IRC. This is not really a bugfix, per-se, but more of a defensive coding measure.
Looks fine to me for that,
Reviewed-by Christoph Hellwig <[email protected]>