PERFORCE change 153988 for review

Qing Li qingli at FreeBSD.org
Tue Dec 2 21:06:19 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=153988

Change 153988 by qingli at FreeBSD-newarp on 2008/12/03 05:06:02

	1. fixed a crash when running TCPIPV6_STREAM test
	          nd6_nud_hint() does not work because it is called
	          by tcp_do_segments() with (rt == NULL)
	    	2. fixed a crash trying to release a lock when the
	   lock has not been acquired
	
	unit test:  ./netperf -6 -H fe80::20f:1fff:fea0:8153%eth0 -p 9999 -t TCP_STREAM
		    ./netperf -6 -H 2001::1 -p 9999 -t TCP_STREAM
		    ./netperf -H x.x.x.x -t TCP_STREAM

Affected files ...

.. //depot/projects/arp-v2/src/sys/netinet/if_ether.c#20 edit
.. //depot/projects/arp-v2/src/sys/netinet6/nd6.c#10 edit

Differences ...

==== //depot/projects/arp-v2/src/sys/netinet/if_ether.c#20 (text+ko) ====

@@ -429,7 +429,7 @@
 	struct sockaddr sa;
 	struct in_addr isaddr, itaddr, myaddr;
 	u_int8_t *enaddr = NULL;
-	int op, flag;
+	int op, flag, lock_owned = 0;
 /*
 , rif_len;
 */
@@ -558,6 +558,7 @@
 	sin.sin_addr = isaddr;
 	flag = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0;
 	IF_AFDATA_LOCK(ifp); 
+	lock_owned = 1;
 	la = lla_lookup(LLTABLE(ifp), flag, (struct sockaddr *)&sin);
 	if (la != NULL) {
 		/* the following is not an error when doing bridging */
@@ -693,7 +694,10 @@
 		}
 	}
 
-	IF_AFDATA_UNLOCK(ifp);
+	if (lock_owned != 0) {
+		IF_AFDATA_UNLOCK(ifp);
+		lock_owned = 0;
+	}
 
 	if (itaddr.s_addr == myaddr.s_addr &&
 	    IN_LINKLOCAL(ntohl(itaddr.s_addr))) {
@@ -720,7 +724,8 @@
 	return;
 
 drop:
-	IF_AFDATA_UNLOCK(ifp);
+	if (lock_owned != 0)
+		IF_AFDATA_UNLOCK(ifp);
 	m_freem(m);
 }
 #endif

==== //depot/projects/arp-v2/src/sys/netinet6/nd6.c#10 (text+ko) ====

@@ -1056,11 +1056,14 @@
 {
 	INIT_VNET_INET6(curvnet);
 	struct llentry *ln;
-	struct ifnet *ifp = rt->rt_ifp;
+	struct ifnet *ifp = NULL;
 
 	if (dst6 == NULL)
 		return;
+	if (rt == NULL)
+		return;
 
+	ifp = rt->rt_ifp;
 	IF_AFDATA_LOCK(ifp);
 	if ((ln = nd6_lookup(dst6, 0, NULL)) == NULL) {
 		IF_AFDATA_UNLOCK(ifp);


More information about the p4-projects mailing list