Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Check MP-safety in ifa_insert and ifa_remove only fo...
details: https://anonhg.NetBSD.org/src/rev/a4dff568900c
branches: trunk
changeset: 828916:a4dff568900c
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Jan 10 01:22:26 2018 +0000
description:
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 a47ce006d823 -r a4dff568900c sys/net/if.c
--- a/sys/net/if.c Tue Jan 09 22:58:45 2018 +0000
+++ b/sys/net/if.c Wed Jan 10 01:22:26 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.417 2017/12/26 02:01:35 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.418 2018/01/10 01:22:26 ozaki-r 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.417 2017/12/26 02:01:35 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.418 2018/01/10 01:22:26 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1793,12 +1793,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);
@@ -1814,10 +1815,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