Skip to content

Commit

Permalink
nfsd: only fill out return pointer on success in nfsd4_lookup_stateid
Browse files Browse the repository at this point in the history
In the case of a revoked delegation, we still fill out the pointer even
when returning an error, which is bad form. Only overwrite the pointer
on success.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Jeff Layton authored and Chuck Lever committed Sep 26, 2022
1 parent 019805f commit 4d01416
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -6266,6 +6266,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
struct nfs4_stid **s, struct nfsd_net *nn)
{
__be32 status;
struct nfs4_stid *stid;
bool return_revoked = false;

/*
Expand All @@ -6288,15 +6289,16 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
}
if (status)
return status;
*s = find_stateid_by_type(cstate->clp, stateid, typemask);
if (!*s)
stid = find_stateid_by_type(cstate->clp, stateid, typemask);
if (!stid)
return nfserr_bad_stateid;
if (((*s)->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
nfs4_put_stid(*s);
if ((stid->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
nfs4_put_stid(stid);
if (cstate->minorversion)
return nfserr_deleg_revoked;
return nfserr_bad_stateid;
}
*s = stid;
return nfs_ok;
}

Expand Down

0 comments on commit 4d01416

Please sign in to comment.