svn commit: r366052 - stable/11/sys/fs/nfsserver

Rick Macklem rmacklem at FreeBSD.org
Wed Sep 23 01:56:22 UTC 2020


Author: rmacklem
Date: Wed Sep 23 01:56:21 2020
New Revision: 366052
URL: https://svnweb.freebsd.org/changeset/base/366052

Log:
  MFC: r365789
  Fix a LOR between the NFS server and server side krpc.
  
  Recent testing of the NFS-over-TLS code found a LOR between the mutex lock
  used for sessions and the sleep lock used for server side krpc socket
  structures.
  The code in nfsrv_checksequence() would call SVC_RELEASE() with the mutex
  held.  Normally this is ok, since all that happens is SVC_RELEASE()
  decrements a reference count.  However, if the socket has just been shut
  down, SVC_RELEASE() drops the reference count to 0 and acquires a sleep
  lock during destruction of the server side krpc structure.
  
  This patch fixes the problem by moving the SVC_RELEASE() call in
  nfsrv_checksequence() down a few lines to below where the mutex is released.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c	Wed Sep 23 01:51:01 2020	(r366051)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c	Wed Sep 23 01:56:21 2020	(r366052)
@@ -6091,6 +6091,7 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_
 	 * bound as well, do the implicit binding unless a
 	 * BindConnectiontoSession has already been done on the session.
 	 */
+	savxprt = NULL;
 	if (sep->sess_clp->lc_req.nr_client != NULL &&
 	    sep->sess_cbsess.nfsess_xprt != nd->nd_xprt &&
 	    (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0 &&
@@ -6103,14 +6104,14 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_
 		    sep->sess_clp->lc_req.nr_client->cl_private;
 		nd->nd_xprt->xp_idletimeout = 0;	/* Disable timeout. */
 		sep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
-		if (savxprt != NULL)
-			SVC_RELEASE(savxprt);
 	}
 
 	*sflagsp = 0;
 	if (sep->sess_clp->lc_req.nr_client == NULL)
 		*sflagsp |= NFSV4SEQ_CBPATHDOWN;
 	NFSUNLOCKSESSION(shp);
+	if (savxprt != NULL)
+		SVC_RELEASE(savxprt);
 	if (error == NFSERR_EXPIRED) {
 		*sflagsp |= NFSV4SEQ_EXPIREDALLSTATEREVOKED;
 		error = 0;


More information about the svn-src-all mailing list