svn commit: r366117 - stable/12/sys/fs/nfsserver

Rick Macklem rmacklem at FreeBSD.org
Thu Sep 24 15:34:48 UTC 2020


Author: rmacklem
Date: Thu Sep 24 15:34:47 2020
New Revision: 366117
URL: https://svnweb.freebsd.org/changeset/base/366117

Log:
  MFC: r365895
  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 in nfsrv_checksequence().  This was fixed by r365789.
  A similar bug exists in nfsrv_bindconnsess(), where SVC_RELEASE() is called
  while mutexes are held.
  This patch applies a fix similar to r365789, moving the SVC_RELEASE() call
  down to after the mutexes are released.
  
  This patch fixes the problem by moving the SVC_RELEASE() call in
  nfsrv_bindconnsess() down a few lines to below where the mutexes are released.

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

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- stable/12/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Sep 24 14:59:10 2020	(r366116)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdstate.c	Thu Sep 24 15:34:47 2020	(r366117)
@@ -6405,6 +6405,7 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t 
 	int error;
 
 	error = 0;
+	savxprt = NULL;
 	shp = NFSSESSIONHASH(sessionid);
 	NFSLOCKSTATE();
 	NFSLOCKSESSION(shp);
@@ -6432,8 +6433,6 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t 
 				/* Disable idle timeout. */
 				nd->nd_xprt->xp_idletimeout = 0;
 				sep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
-				if (savxprt != NULL)
-					SVC_RELEASE(savxprt);
 				sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN;
 				clp->lc_flags |= LCL_DONEBINDCONN;
 				if (*foreaftp == NFSCDFS4_BACK)
@@ -6460,6 +6459,8 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t 
 		error = NFSERR_BADSESSION;
 	NFSUNLOCKSESSION(shp);
 	NFSUNLOCKSTATE();
+	if (savxprt != NULL)
+		SVC_RELEASE(savxprt);
 	return (error);
 }
 


More information about the svn-src-stable mailing list