Source-Changes-HG archive

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

[src/trunk]: src/sys/net Check if ether_ifdetach is called without INET_LOCK



details:   https://anonhg.NetBSD.org/src/rev/41f4fa99a588
branches:  trunk
changeset: 319802:41f4fa99a588
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jun 12 07:12:35 2018 +0000

description:
Check if ether_ifdetach is called without INET_LOCK

diffstat:

 sys/net/if.h           |  5 ++++-
 sys/net/if_ethersubr.c |  5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r 12f386c20c10 -r 41f4fa99a588 sys/net/if.h
--- a/sys/net/if.h      Tue Jun 12 04:21:22 2018 +0000
+++ b/sys/net/if.h      Tue Jun 12 07:12:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.261 2018/05/01 06:50:06 maxv Exp $    */
+/*     $NetBSD: if.h,v 1.262 2018/06/12 07:12:35 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -1300,6 +1300,9 @@
 #define IFNET_UNLOCK(ifp)      mutex_exit((ifp)->if_ioctl_lock)
 #define IFNET_LOCKED(ifp)      mutex_owned((ifp)->if_ioctl_lock)
 
+#define IFNET_ASSERT_UNLOCKED(ifp)     \
+       KDASSERT(mutex_ownable((ifp)->if_ioctl_lock))
+
 extern struct pslist_head ifnet_pslist;
 extern kmutex_t ifnet_mtx;
 
diff -r 12f386c20c10 -r 41f4fa99a588 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Tue Jun 12 04:21:22 2018 +0000
+++ b/sys/net/if_ethersubr.c    Tue Jun 12 07:12:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.268 2018/05/29 16:24:34 maxv Exp $  */
+/*     $NetBSD: if_ethersubr.c,v 1.269 2018/06/12 07:12:35 ozaki-r Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.268 2018/05/29 16:24:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.269 2018/06/12 07:12:35 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1021,6 +1021,7 @@
        struct ethercom *ec = (void *) ifp;
        struct ether_multi *enm;
 
+       IFNET_ASSERT_UNLOCKED(ifp);
        /*
         * Prevent further calls to ioctl (for example turning off
         * promiscuous mode from the bridge code), which eventually can



Home | Main Index | Thread Index | Old Index