summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2011-10-28 12:49:43 +0000
committerkrw <krw@openbsd.org>2011-10-28 12:49:43 +0000
commit053958bc2a6ffdcc51402c7df6eabee279015452 (patch)
tree375376c144008be6231f50dc5a82914c9367f05e
parentFix bogus frame selection check in uvideo_vs_negotiation(). (diff)
downloadwireguard-openbsd-053958bc2a6ffdcc51402c7df6eabee279015452.tar.xz
wireguard-openbsd-053958bc2a6ffdcc51402c7df6eabee279015452.zip
Take more care to ensure all callbacks are initialized. In particular
tr_linkstate() was not initialized in trunk_rr_attach(), and tr_init() and tr_stop() were missing in trunk_lb_attach(). Fixes crash triggered by changing trunkproto, reported by Anders Berggren on bugs@. ok mpf henning
-rw-r--r--sys/net/if_trunk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c
index b61dcaa1618..5ceb6cb5e72 100644
--- a/sys/net/if_trunk.c
+++ b/sys/net/if_trunk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_trunk.c,v 1.77 2011/01/28 14:20:37 reyk Exp $ */
+/* $OpenBSD: if_trunk.c,v 1.78 2011/10/28 12:49:43 krw Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1228,6 +1228,7 @@ trunk_rr_attach(struct trunk_softc *tr)
tr->tr_input = trunk_rr_input;
tr->tr_init = NULL;
tr->tr_stop = NULL;
+ tr->tr_linkstate = NULL;
tr->tr_port_create = NULL;
tr->tr_port_destroy = trunk_rr_port_destroy;
tr->tr_capabilities = IFCAP_TRUNK_FULLDUPLEX;
@@ -1386,6 +1387,8 @@ trunk_lb_attach(struct trunk_softc *tr)
tr->tr_capabilities = IFCAP_TRUNK_FULLDUPLEX;
tr->tr_req = NULL;
tr->tr_portreq = NULL;
+ tr->tr_init = NULL;
+ tr->tr_stop = NULL;
lb->lb_key = arc4random();
tr->tr_psc = (caddr_t)lb;