Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2013 00:39:56 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r259207 - stable/10/sys/fs/nfs
Message-ID:  <201312110039.rBB0dulK098266@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Dec 11 00:39:56 2013
New Revision: 259207
URL: http://svnweb.freebsd.org/changeset/base/259207

Log:
  MFC: r257598
  During code inspection, I spotted that there was a code path where
  CLNT_CONTROL() would be called on "client" after it was
  released via CLNT_RELEASE(). It was unlikely that this
  code path gets executed and I have not heard of any problem
  report caused by this bug. This patch fixes the code so that
  this cannot happen.

Modified:
  stable/10/sys/fs/nfs/nfs_commonkrpc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- stable/10/sys/fs/nfs/nfs_commonkrpc.c	Wed Dec 11 00:17:13 2013	(r259206)
+++ stable/10/sys/fs/nfs/nfs_commonkrpc.c	Wed Dec 11 00:39:56 2013	(r259207)
@@ -336,24 +336,25 @@ newnfs_connect(struct nfsmount *nmp, str
 
 	mtx_lock(&nrp->nr_mtx);
 	if (nrp->nr_client != NULL) {
+		mtx_unlock(&nrp->nr_mtx);
 		/*
 		 * Someone else already connected.
 		 */
 		CLNT_RELEASE(client);
 	} else {
 		nrp->nr_client = client;
+		/*
+		 * Protocols that do not require connections may be optionally
+		 * left unconnected for servers that reply from a port other
+		 * than NFS_PORT.
+		 */
+		if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) {
+			mtx_unlock(&nrp->nr_mtx);
+			CLNT_CONTROL(client, CLSET_CONNECT, &one);
+		} else
+			mtx_unlock(&nrp->nr_mtx);
 	}
 
-	/*
-	 * Protocols that do not require connections may be optionally left
-	 * unconnected for servers that reply from a port other than NFS_PORT.
-	 */
-	if (nmp == NULL || (nmp->nm_flag & NFSMNT_NOCONN) == 0) {
-		mtx_unlock(&nrp->nr_mtx);
-		CLNT_CONTROL(client, CLSET_CONNECT, &one);
-	} else {
-		mtx_unlock(&nrp->nr_mtx);
-	}
 
 	/* Restore current thread's credentials. */
 	td->td_ucred = origcred;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312110039.rBB0dulK098266>