Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by ozaki...



details:   https://anonhg.NetBSD.org/src/rev/576ba6f75365
branches:  netbsd-8
changeset: 851282:576ba6f75365
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Jan 13 05:41:38 2018 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #486):
        sys/net/if.c: revision 1.418
Check MP-safety in ifa_insert and ifa_remove only for IFEF_MPSAFE drivers
Eventually the assertions should pass for all drivers, however, at this point
it's too eager.
Fix PR kern/52895

diffstat:

 sys/net/if.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 12373d840664 -r 576ba6f75365 sys/net/if.c
--- a/sys/net/if.c      Sat Jan 13 05:40:25 2018 +0000
+++ b/sys/net/if.c      Sat Jan 13 05:41:38 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.394.2.4 2018/01/02 10:20:33 snj Exp $ */
+/*     $NetBSD: if.c,v 1.394.2.5 2018/01/13 05:41:38 snj Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.4 2018/01/02 10:20:33 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.5 2018/01/13 05:41:38 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1792,12 +1792,13 @@
        ifa->ifa_ifp = ifp;
 
        /*
+        * Check MP-safety for IFEF_MPSAFE drivers.
         * Check !IFF_RUNNING for initialization routines that normally don't
         * take IFNET_LOCK but it's safe because there is no competitor.
         * XXX there are false positive cases because IFF_RUNNING can be off on
         * if_stop.
         */
-       KASSERT(!ISSET(ifp->if_flags, IFF_RUNNING) ||
+       KASSERT(!if_is_mpsafe(ifp) || !ISSET(ifp->if_flags, IFF_RUNNING) ||
            IFNET_LOCKED(ifp));
 
        TAILQ_INSERT_TAIL(&ifp->if_addrlist, ifa, ifa_list);
@@ -1813,10 +1814,11 @@
 
        KASSERT(ifa->ifa_ifp == ifp);
        /*
+        * Check MP-safety for IFEF_MPSAFE drivers.
         * if_is_deactivated indicates ifa_remove is called form if_detach
         * where is safe even if IFNET_LOCK isn't held.
         */
-       KASSERT(if_is_deactivated(ifp) || IFNET_LOCKED(ifp));
+       KASSERT(!if_is_mpsafe(ifp) || if_is_deactivated(ifp) || IFNET_LOCKED(ifp));
 
        TAILQ_REMOVE(&ifp->if_addrlist, ifa, ifa_list);
        IFADDR_WRITER_REMOVE(ifa);



Home | Main Index | Thread Index | Old Index