Module Name: src
Committed By: snj
Date: Sat Jan 13 05:41:39 UTC 2018
Modified Files:
src/sys/net [netbsd-8]: if.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.394.2.4 -r1.394.2.5 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.394.2.4 src/sys/net/if.c:1.394.2.5
--- src/sys/net/if.c:1.394.2.4 Tue Jan 2 10:20:33 2018
+++ src/sys/net/if.c Sat Jan 13 05:41:38 2018
@@ -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_insert(struct ifnet *ifp, struct ifa
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 @@ ifa_remove(struct ifnet *ifp, struct ifa
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);