Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Oct 2003 15:19:28 -0700 (PDT)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 40125 for review
Message-ID:  <200310212219.h9LMJSW9013165@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=40125

Change 40125 by sam@sam_ebb on 2003/10/21 15:19:09

	apply bandaid to locking problem in divert sockets

Affected files ...

.. //depot/projects/netperf/sys/netinet/ip_divert.c#6 edit

Differences ...

==== //depot/projects/netperf/sys/netinet/ip_divert.c#6 (text+ko) ====

@@ -219,6 +219,20 @@
 			m->m_pkthdr.rcvif->if_unit);
 	}
 
+	/*
+	 * XXX sbappendaddr must be protected by Giant until
+	 * we have locking at the socket layer.  When entered
+	 * from below we come in w/o Giant and must take it
+	 * here.  Unfortunately we cannot tell whether we're
+	 * entering from above (already holding Giant),
+	 * below (potentially without Giant), or otherwise
+	 * (e.g. from tcp_syncache through a timeout) so we
+	 * have to grab it regardless.  This causes a LOR with
+	 * the tcp lock, at least, and possibly others.  For
+	 * the moment we're ignoring this. Once sockets are
+	 * locked this cruft can be removed.
+	 */
+	mtx_lock(&Giant);	/* XXX */
 	/* Put packet on socket queue, if any */
 	sa = NULL;
 	nport = htons((u_int16_t)port);
@@ -240,6 +254,7 @@
 		INP_UNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&divcbinfo);
+	mtx_unlock(&Giant);	/* XXX */
 	if (sa == NULL) {
 		m_freem(m);
 		ipstat.ips_noproto++;



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