Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2018 22:02:00 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335749 - head/sys/netinet
Message-ID:  <201806272202.w5RM20hk030808@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Jun 27 22:01:59 2018
New Revision: 335749
URL: https://svnweb.freebsd.org/changeset/base/335749

Log:
  Check the inp_flags under inp lock. Looks like the race was hidden
  before, the conversion of tcbinfo to CK_LIST have uncovered it.

Modified:
  head/sys/netinet/tcp_subr.c

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Wed Jun 27 22:00:50 2018	(r335748)
+++ head/sys/netinet/tcp_subr.c	Wed Jun 27 22:01:59 2018	(r335749)
@@ -2019,9 +2019,11 @@ tcp_drain(void)
 	 */
 		INP_INFO_WLOCK(&V_tcbinfo);
 		CK_LIST_FOREACH(inpb, V_tcbinfo.ipi_listhead, inp_list) {
-			if (inpb->inp_flags & INP_TIMEWAIT)
-				continue;
 			INP_WLOCK(inpb);
+			if (inpb->inp_flags & INP_TIMEWAIT) {
+				INP_WUNLOCK(inpb);
+				continue;
+			}
 			if ((tcpb = intotcpcb(inpb)) != NULL) {
 				tcp_reass_flush(tcpb);
 				tcp_clean_sackreport(tcpb);



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