Module Name:    src
Committed By:   riz
Date:           Mon Aug 20 19:23:07 UTC 2012

Modified Files:
        src/sys/net [netbsd-6]: if_ethersubr.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #517):
        sys/net/if_ethersubr.c: revision 1.190
PR/46587: Roger Pau Monne: Prevent panic on shutdown on bridge teardown ->
ifpromisc-> if_ioctl -> if_init. Idea from dyoung.
XXX: Pullup to 6.


To generate a diff of this commit:
cvs rdiff -u -r1.188.8.1 -r1.188.8.2 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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.188.8.1 src/sys/net/if_ethersubr.c:1.188.8.2
--- src/sys/net/if_ethersubr.c:1.188.8.1	Fri May 18 17:04:28 2012
+++ src/sys/net/if_ethersubr.c	Mon Aug 20 19:23:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.188.8.1 2012/05/18 17:04:28 riz Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.188.8.2 2012/08/20 19:23:07 riz 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.188.8.1 2012/05/18 17:04:28 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.188.8.2 2012/08/20 19:23:07 riz Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -1144,6 +1144,15 @@ ether_ifdetach(struct ifnet *ifp)
 	struct ether_multi *enm;
 	int s;
 
+	/*
+	 * Prevent further calls to ioctl (for example turning off
+	 * promiscuous mode from the bridge code), which eventually can
+	 * call if_init() which can cause panics because the interface
+	 * is in the process of being detached. Return device not configured
+	 * instead.
+	 */
+	ifp->if_ioctl = (int (*)(struct ifnet *, u_long, void *))enxio;
+
 #if NBRIDGE > 0
 	if (ifp->if_bridge)
 		bridge_ifdetach(ifp);

Reply via email to