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

Commit 7ca9e47

Browse files
Olga Kornievskaiagregkh
Olga Kornievskaia
authored andcommitted
nfsd: fix possible badness in FREE_STATEID
[ Upstream commit c88c150 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 498484c commit 7ca9e47

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
@@ -7158,6 +7158,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
71587158
switch (s->sc_type) {
71597159
case SC_TYPE_DELEG:
71607160
if (s->sc_status & SC_STATUS_REVOKED) {
7161+
s->sc_status |= SC_STATUS_CLOSED;
71617162
spin_unlock(&s->sc_lock);
71627163
dp = delegstateid(s);
71637164
list_del_init(&dp->dl_recall_lru);

0 commit comments

Comments
 (0)