Module Name: src
Committed By: christos
Date: Tue Jul 17 18:08:20 UTC 2012
Modified Files:
src/sys/net: if_ethersubr.c
Log Message:
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.189 -r1.190 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.189 src/sys/net/if_ethersubr.c:1.190
--- src/sys/net/if_ethersubr.c:1.189 Fri May 11 00:05:54 2012
+++ src/sys/net/if_ethersubr.c Tue Jul 17 14:08:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ethersubr.c,v 1.189 2012/05/11 04:05:54 chs Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.190 2012/07/17 18:08:20 christos 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.189 2012/05/11 04:05:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.190 2012/07/17 18:08:20 christos 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);