Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit c88c150

Browse files
Olga Kornievskaiachucklever
Olga Kornievskaia
authored andcommitted
nfsd: fix possible badness in FREE_STATEID
When multiple FREE_STATEIDs are sent for the same delegation stateid, it can lead to a possible either use-after-free or counter refcount underflow errors. In nfsd4_free_stateid() under the client lock we find a delegation stateid, however the code drops the lock before calling nfs4_put_stid(), that allows another FREE_STATE to find the stateid again. The first one will proceed to then free the stateid which leads to either use-after-free or decrementing already zeroed counter. Fixes: 3f29cc8 ("nfsd: split sc_status out of sc_type") Signed-off-by: Olga Kornievskaia <okorniev@redhat.com> Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 53e4e17 commit c88c150

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/nfsd/nfs4state.c

+1
Original file line numberDiff line numberDiff line change
@@ -7154,6 +7154,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
71547154
switch (s->sc_type) {
71557155
case SC_TYPE_DELEG:
71567156
if (s->sc_status & SC_STATUS_REVOKED) {
7157+
s->sc_status |= SC_STATUS_CLOSED;
71577158
spin_unlock(&s->sc_lock);
71587159
dp = delegstateid(s);
71597160
list_del_init(&dp->dl_recall_lru);

0 commit comments

Comments
 (0)