svn commit: r257598 - head/sys/fs/nfs
Rick Macklem
rmacklem at FreeBSD.org
Sun Nov 3 23:17:31 UTC 2013
Author: rmacklem
Date: Sun Nov 3 23:17:30 2013
New Revision: 257598
URL: http://svnweb.freebsd.org/changeset/base/257598
Log:
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.
MFC after: 2 months
Modified:
head/sys/fs/nfs/nfs_commonkrpc.c
Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c Sun Nov 3 23:06:24 2013 (r257597)
+++ head/sys/fs/nfs/nfs_commonkrpc.c Sun Nov 3 23:17:30 2013 (r257598)
@@ -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;
More information about the svn-src-all
mailing list