summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2016-06-29 05:21:25 +0000
committerbz <bz@FreeBSD.org>2016-06-29 05:21:25 +0000
commit2acea814a2b1bf204fbd8bcd23c9225528a02bf1 (patch)
tree8c7e091987548ca5983e8fe10f155ec14443566e /sys/net
parent1e1f5317b73b45be67126beb4388fb4e8d6a6649 (diff)
downloadFreeBSD-src-2acea814a2b1bf204fbd8bcd23c9225528a02bf1.zip
FreeBSD-src-2acea814a2b1bf204fbd8bcd23c9225528a02bf1.tar.gz
Several device drivers call if_alloc() and then do further checks and
will cal if_free() in case of conflict, error, .. if_free() however sets the VNET instance from the ifp->if_vnet which was not yet initialized but would only in if_attach(). Fix this by setting the curvnet from where we allocate the interface in if_alloc(). if_attach() will later overwrite this as needed. We do not set the home_vnet early on as we only want to prevent the if_free() panic but not change any of the other housekeeping, e.g., triggered through ifioctl()s. Reviewed by: brooks Approved by: re (gjb) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7010
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index c351bea..0fd66c9 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -455,6 +455,9 @@ if_alloc(u_char type)
ifp->if_index = idx;
ifp->if_type = type;
ifp->if_alloctype = type;
+#ifdef VIMAGE
+ ifp->if_vnet = curvnet;
+#endif
if (if_com_alloc[type] != NULL) {
ifp->if_l2com = if_com_alloc[type](type, ifp);
if (ifp->if_l2com == NULL) {
OpenPOWER on IntegriCloud