freebsd-nq/sys/fs/nfsserver
Rick Macklem e1a907a25c krpc: Acquire ref count of CLIENT for backchannel use
Michael Dexter <editor@callfortesting.org> reported
a crash in FreeNAS, where the first argument to
clnt_bck_svccall() was no longer valid.
This argument is a pointer to the callback CLIENT
structure, which is free'd when the associated
NFSv4 ClientID is free'd.

This appears to have occurred because a callback
reply was still in the socket receive queue when
the CLIENT structure was free'd.

This patch acquires a reference count on the CLIENT
that is not CLNT_RELEASE()'d until the socket structure
is destroyed. This should guarantee that the CLIENT
structure is still valid when clnt_bck_svccall() is called.
It also adds a check for closed or closing to
clnt_bck_svccall() so that it will not process the callback
RPC reply message after the ClientID is free'd.

Comments by:	mav
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30153
2021-06-11 16:57:14 -07:00
..
nfs_fha_new.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
nfs_fha_new.h Re-organize the NFS file handle affinity code for the NFS server. 2020-04-14 00:01:26 +00:00
nfs_nfsdcache.c fs: clean up empty lines in .c and .h files 2020-09-01 21:18:40 +00:00
nfs_nfsdkrpc.c nfsd: fix replies from session cache for retried RPCs 2021-04-08 14:04:22 -07:00
nfs_nfsdport.c nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients 2021-06-05 16:53:07 -07:00
nfs_nfsdserv.c nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients 2021-06-05 16:53:07 -07:00
nfs_nfsdsocket.c nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients 2021-06-05 16:53:07 -07:00
nfs_nfsdstate.c krpc: Acquire ref count of CLIENT for backchannel use 2021-06-11 16:57:14 -07:00
nfs_nfsdsubs.c nfsd: Fix the failure return for non-fh NFSv4 operations 2021-06-02 15:28:07 -07:00