svn commit: r366050 - stable/12/sys/fs/nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Wed Sep 23 01:49:51 UTC 2020
Author: rmacklem
Date: Wed Sep 23 01:49:50 2020
New Revision: 366050
URL: https://svnweb.freebsd.org/changeset/base/366050
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/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 Wed Sep 23 01:49:37 2020 (r366049)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdstate.c Wed Sep 23 01:49:50 2020 (r366050)
@@ -6214,6 +6214,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 &&
@@ -6226,14 +6227,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