Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Nov 2012 20:22:39 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242671 - head/sys/dev/cxgbe/tom
Message-ID:  <201211062022.qA6KMd7M043063@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Nov  6 20:22:39 2012
New Revision: 242671
URL: http://svnweb.freebsd.org/changeset/base/242671

Log:
  Make sure the inp hasn't been dropped before trying to access its socket
  and tcpcb.
  
  MFC after:	3 days

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c	Tue Nov  6 19:54:24 2012	(r242670)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c	Tue Nov  6 20:22:39 2012	(r242671)
@@ -982,7 +982,6 @@ do_abort_req(struct sge_iq *iq, const st
 	struct sge_wrq *ofld_txq = toep->ofld_txq;
 	struct inpcb *inp;
 	struct tcpcb *tp;
-	struct socket *so;
 #ifdef INVARIANTS
 	unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl)));
 #endif
@@ -1008,7 +1007,6 @@ do_abort_req(struct sge_iq *iq, const st
 	INP_WLOCK(inp);
 
 	tp = intotcpcb(inp);
-	so = inp->inp_socket;
 
 	CTR6(KTR_CXGBE,
 	    "%s: tid %d (%s), toep_flags 0x%x, inp_flags 0x%x, status %d",
@@ -1026,10 +1024,16 @@ do_abort_req(struct sge_iq *iq, const st
 	}
 	toep->flags |= TPF_ABORT_SHUTDOWN;
 
-	so_error_set(so, abort_status_to_errno(tp, cpl->status));
-	tp = tcp_close(tp);
-	if (tp == NULL)
-		INP_WLOCK(inp);	/* re-acquire */
+	if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) == 0) {
+		struct socket *so = inp->inp_socket;
+
+		if (so != NULL)
+			so_error_set(so, abort_status_to_errno(tp,
+			    cpl->status));
+		tp = tcp_close(tp);
+		if (tp == NULL)
+			INP_WLOCK(inp);	/* re-acquire */
+	}
 
 	final_cpl_received(toep);
 done:



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