svn commit: r251698 - stable/9/sys/rpc

John Baldwin jhb at FreeBSD.org
Thu Jun 13 19:25:37 UTC 2013


Author: jhb
Date: Thu Jun 13 19:25:36 2013
New Revision: 251698
URL: http://svnweb.freebsd.org/changeset/base/251698

Log:
  MFC 249263: Fix a potential socket leak in the NFS server.

Modified:
  stable/9/sys/rpc/svc_vc.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/rpc/svc_vc.c
==============================================================================
--- stable/9/sys/rpc/svc_vc.c	Thu Jun 13 18:47:53 2013	(r251697)
+++ stable/9/sys/rpc/svc_vc.c	Thu Jun 13 19:25:36 2013	(r251698)
@@ -137,7 +137,9 @@ svc_vc_create(SVCPOOL *pool, struct sock
 	struct sockaddr* sa;
 	int error;
 
-	if (so->so_state & SS_ISCONNECTED) {
+	SOCK_LOCK(so);
+	if (so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED)) {
+		SOCK_UNLOCK(so);
 		error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa);
 		if (error)
 			return (NULL);
@@ -145,6 +147,7 @@ svc_vc_create(SVCPOOL *pool, struct sock
 		free(sa, M_SONAME);
 		return (xprt);
 	}
+	SOCK_UNLOCK(so);
 
 	xprt = svc_xprt_alloc();
 	sx_init(&xprt->xp_lock, "xprt->xp_lock");


More information about the svn-src-stable-9 mailing list