Module Name:    src
Committed By:   ozaki-r
Date:           Wed Mar  1 03:02:35 UTC 2017

Modified Files:
        src/sys/netinet6: in6.c nd6.c

Log Message:
Restore/add some softnet_lock for nd6_rt_flush and defrouter_addreq

May help PR kern/52015


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/netinet6/in6.c
cvs rdiff -u -r1.230 -r1.231 src/sys/netinet6/nd6.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.240 src/sys/netinet6/in6.c:1.241
--- src/sys/netinet6/in6.c:1.240	Tue Feb 28 04:07:11 2017
+++ src/sys/netinet6/in6.c	Wed Mar  1 03:02:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.240 2017/02/28 04:07:11 ozaki-r Exp $	*/
+/*	$NetBSD: in6.c,v 1.241 2017/03/01 03:02:35 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.240 2017/02/28 04:07:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.241 2017/03/01 03:02:35 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2655,7 +2655,13 @@ in6_domifdetach(struct ifnet *ifp, void 
 
 	lltable_free(ext->lltable);
 	ext->lltable = NULL;
+#ifndef NET_MPSAFE
+	mutex_enter(softnet_lock);
+#endif
 	nd6_ifdetach(ifp, ext);
+#ifndef NET_MPSAFE
+	mutex_exit(softnet_lock);
+#endif
 	free(ext->in6_ifstat, M_IFADDR);
 	free(ext->icmp6_ifstat, M_IFADDR);
 	scope6_ifdetach(ext->scope6_id);

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.230 src/sys/netinet6/nd6.c:1.231
--- src/sys/netinet6/nd6.c:1.230	Wed Feb 22 07:46:00 2017
+++ src/sys/netinet6/nd6.c	Wed Mar  1 03:02:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.230 2017/02/22 07:46:00 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.231 2017/03/01 03:02:35 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.230 2017/02/22 07:46:00 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.231 2017/03/01 03:02:35 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -450,6 +450,10 @@ nd6_llinfo_timer(void *arg)
 	bool send_ns = false;
 	const struct in6_addr *daddr6 = NULL;
 
+#ifndef NET_MPSAFE
+	mutex_enter(softnet_lock);
+	KERNEL_LOCK(1, NULL);
+#endif
 	LLE_WLOCK(ln);
 	if ((ln->la_flags & LLE_LINKED) == 0)
 		goto out;
@@ -506,16 +510,8 @@ nd6_llinfo_timer(void *arg)
 			nd6_free(ln, 0);
 			ln = NULL;
 			if (m != NULL) {
-#ifndef NET_MPSAFE
-				mutex_enter(softnet_lock);
-				KERNEL_LOCK(1, NULL);
-#endif
 				icmp6_error2(m, ICMP6_DST_UNREACH,
 				    ICMP6_DST_UNREACH_ADDR, 0, ifp);
-#ifndef NET_MPSAFE
-				KERNEL_UNLOCK_ONE(NULL);
-				mutex_exit(softnet_lock);
-#endif
 			}
 		}
 		break;
@@ -567,20 +563,16 @@ nd6_llinfo_timer(void *arg)
 		psrc = nd6_llinfo_get_holdsrc(ln, &src);
 		LLE_FREE_LOCKED(ln);
 		ln = NULL;
-#ifndef NET_MPSAFE
-		mutex_enter(softnet_lock);
-		KERNEL_LOCK(1, NULL);
-#endif
 		nd6_ns_output(ifp, daddr6, taddr6, psrc, 0);
-#ifndef NET_MPSAFE
-		KERNEL_UNLOCK_ONE(NULL);
-		mutex_exit(softnet_lock);
-#endif
 	}
 
 out:
 	if (ln != NULL)
 		LLE_FREE_LOCKED(ln);
+#ifndef NET_MPSAFE
+	KERNEL_UNLOCK_ONE(NULL);
+	mutex_exit(softnet_lock);
+#endif
 }
 
 /*

Reply via email to