Skip to content

Commit 4d01416

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: only fill out return pointer on success in nfsd4_lookup_stateid
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 <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 019805f commit 4d01416

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/nfsd/nfs4state.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6266,6 +6266,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
62666266
struct nfs4_stid **s, struct nfsd_net *nn)
62676267
{
62686268
__be32 status;
6269+
struct nfs4_stid *stid;
62696270
bool return_revoked = false;
62706271

62716272
/*
@@ -6288,15 +6289,16 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
62886289
}
62896290
if (status)
62906291
return status;
6291-
*s = find_stateid_by_type(cstate->clp, stateid, typemask);
6292-
if (!*s)
6292+
stid = find_stateid_by_type(cstate->clp, stateid, typemask);
6293+
if (!stid)
62936294
return nfserr_bad_stateid;
6294-
if (((*s)->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
6295-
nfs4_put_stid(*s);
6295+
if ((stid->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
6296+
nfs4_put_stid(stid);
62966297
if (cstate->minorversion)
62976298
return nfserr_deleg_revoked;
62986299
return nfserr_bad_stateid;
62996300
}
6301+
*s = stid;
63006302
return nfs_ok;
63016303
}
63026304

0 commit comments

Comments
 (0)