]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd: fix possible badness in FREE_STATEID
authorOlga Kornievskaia <okorniev@redhat.com>
Fri, 4 Oct 2024 22:04:03 +0000 (18:04 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sat, 5 Oct 2024 19:44:25 +0000 (15:44 -0400)
commitc88c150a467fcb670a1608e2272beeee3e86df6e
tree056f5666ded0d381bc29d45f53c483e21aee1f47
parent53e4e17557049d7688ca9dadeae80864d40cf0b7
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: 3f29cc82a84c ("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>
fs/nfsd/nfs4state.c