]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfsd: call nfsd_last_thread() before final nfsd_put()
authorNeilBrown <neilb@suse.de>
Fri, 15 Dec 2023 00:56:31 +0000 (11:56 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:18:37 +0000 (15:18 +0100)
commitbb4f791cb2de1140d0fbcedfe9e791ff364021d7
treec707991e507e368e4214a5862e610114bf6ed3c4
parent03d68ffc48b94cc1e15bbf3b4f16f1e1e4fa286a
nfsd: call nfsd_last_thread() before final nfsd_put()

[ Upstream commit 2a501f55cd641eb4d3c16a2eab0d678693fac663 ]

If write_ports_addfd or write_ports_addxprt fail, they call nfsd_put()
without calling nfsd_last_thread().  This leaves nn->nfsd_serv pointing
to a structure that has been freed.

So remove 'static' from nfsd_last_thread() and call it when the
nfsd_serv is about to be destroyed.

Fixes: ec52361df99b ("SUNRPC: stop using ->sv_nrthreads as a refcount")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/nfsctl.c
fs/nfsd/nfsd.h
fs/nfsd/nfssvc.c