Module Name:    src
Committed By:   ozaki-r
Date:           Tue Jun 12 07:12:35 UTC 2018

Modified Files:
        src/sys/net: if.h if_ethersubr.c

Log Message:
Check if ether_ifdetach is called without INET_LOCK


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/sys/net/if.h
cvs rdiff -u -r1.268 -r1.269 src/sys/net/if_ethersubr.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.h
diff -u src/sys/net/if.h:1.261 src/sys/net/if.h:1.262
--- src/sys/net/if.h:1.261	Tue May  1 06:50:06 2018
+++ src/sys/net/if.h	Tue Jun 12 07:12:35 2018
@@ -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 @@ __END_DECLS
 #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;
 

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.268 src/sys/net/if_ethersubr.c:1.269
--- src/sys/net/if_ethersubr.c:1.268	Tue May 29 16:24:34 2018
+++ src/sys/net/if_ethersubr.c	Tue Jun 12 07:12:35 2018
@@ -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 @@ ether_ifdetach(struct ifnet *ifp)
 	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

Reply via email to