Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Restore/add some softnet_lock for nd6_rt_flush ...



details:   https://anonhg.NetBSD.org/src/rev/4191cf2c70e9
branches:  trunk
changeset: 822089:4191cf2c70e9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Mar 01 03:02:35 2017 +0000

description:
Restore/add some softnet_lock for nd6_rt_flush and defrouter_addreq

May help PR kern/52015

diffstat:

 sys/netinet6/in6.c |  10 ++++++++--
 sys/netinet6/nd6.c |  28 ++++++++++------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diffs (103 lines):

diff -r c5d828e40bd5 -r 4191cf2c70e9 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Wed Mar 01 00:41:39 2017 +0000
+++ b/sys/netinet6/in6.c        Wed Mar 01 03:02:35 2017 +0000
@@ -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 @@
 
        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);
diff -r c5d828e40bd5 -r 4191cf2c70e9 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Wed Mar 01 00:41:39 2017 +0000
+++ b/sys/netinet6/nd6.c        Wed Mar 01 03:02:35 2017 +0000
@@ -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 @@
        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_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 @@
                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
 }
 
 /*



Home | Main Index | Thread Index | Old Index