Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2018 13:13:30 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r336667 - stable/11/sys/dev/cxgbe/iw_cxgbe
Message-ID:  <201807241313.w6ODDUs8029698@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Jul 24 13:13:30 2018
New Revision: 336667
URL: https://svnweb.freebsd.org/changeset/base/336667

Log:
  cxgbe/iw_cxgbe: Do not call soaccept twice on the same socket.
  
  This is a direct commit to stable/11.
  
  Reported by:	Sai Tallamraju @ Netapp
  Sponsored by:	Chelsio Communications

Modified:
  stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c
==============================================================================
--- stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c	Tue Jul 24 12:55:54 2018	(r336666)
+++ stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c	Tue Jul 24 13:13:30 2018	(r336667)
@@ -947,7 +947,6 @@ process_newconn(struct c4iw_listen_ep *master_lep, str
 {
 	struct c4iw_listen_ep *real_lep = NULL;
 	struct c4iw_ep *new_ep = NULL;
-	struct sockaddr_in *remote = NULL;
 	int ret = 0;
 
 	MPASS(new_so != NULL);
@@ -992,20 +991,6 @@ process_newconn(struct c4iw_listen_ep *master_lep, str
 	START_EP_TIMER(new_ep);
 
 	setiwsockopt(new_so);
-	ret = soaccept(new_so, (struct sockaddr **)&remote);
-	if (ret != 0) {
-		CTR4(KTR_IW_CXGBE,
-				"%s:listen sock:%p, new sock:%p, ret:%d\n",
-				__func__, master_lep->com.so, new_so, ret);
-		if (remote != NULL)
-			free(remote, M_SONAME);
-		uninit_iwarp_socket(new_so);
-		soclose(new_so);
-		c4iw_put_ep(&new_ep->com);
-		c4iw_put_ep(&real_lep->com);
-		return;
-	}
-	free(remote, M_SONAME);
 
 	/* MPA request might have been queued up on the socket already, so we
 	 * initialize the socket/upcall_handler under lock to prevent processing
@@ -1118,8 +1103,10 @@ dequeue_socket(struct socket *head)
 	SOCK_UNLOCK(so);
 	ACCEPT_UNLOCK();
 	remote = NULL;
-	soaccept(so, (struct sockaddr **)&remote);
-
+	if (soaccept(so, (struct sockaddr **)&remote) != 0) {
+		soclose(so);
+		so = NULL;
+	}
 	free(remote, M_SONAME);
 	return so;
 }



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