summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2006-05-22 23:25:15 +0000
committerkrw <krw@openbsd.org>2006-05-22 23:25:15 +0000
commit5a278d72bd5dcee33ba18b308a68634b5ae9df95 (patch)
treeb84cb3df1bee094bb1a8f436f1f595b5dbdf9487
parent- fix and prettify SIOP_DEBUG (diff)
downloadwireguard-openbsd-5a278d72bd5dcee33ba18b308a68634b5ae9df95.tar.xz
wireguard-openbsd-5a278d72bd5dcee33ba18b308a68634b5ae9df95.zip
Check for NULL cookies before calling hook_disestablish(). Just in case
the establish calls were bypassed or failed. ok mpf@
-rw-r--r--sys/net/if_vlan.c5
-rw-r--r--sys/netinet/ip_carp.c7
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index ab7813a6e4e..d8c4c99ccfa 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.67 2006/05/09 19:43:02 mpf Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.68 2006/05/22 23:25:15 krw Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -436,7 +436,8 @@ vlan_unconfig(struct ifnet *ifp)
s = splnet();
LIST_REMOVE(ifv, ifv_list);
- hook_disestablish(p->if_linkstatehooks, ifv->lh_cookie);
+ if (ifv->lh_cookie != NULL)
+ hook_disestablish(p->if_linkstatehooks, ifv->lh_cookie);
/* The cookie is NULL if disestablished externally */
if (ifv->dh_cookie != NULL)
hook_disestablish(p->if_detachhooks, ifv->dh_cookie);
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index f81a8596044..9d392445a89 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.124 2006/05/18 12:39:23 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.125 2006/05/22 23:25:15 krw Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -835,8 +835,9 @@ carpdetach(struct carp_softc *sc)
s = splnet();
if (sc->sc_carpdev != NULL) {
- hook_disestablish(sc->sc_carpdev->if_linkstatehooks,
- sc->lh_cookie);
+ if (sc->lh_cookie != NULL)
+ hook_disestablish(sc->sc_carpdev->if_linkstatehooks,
+ sc->lh_cookie);
cif = (struct carp_if *)sc->sc_carpdev->if_carp;
TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
if (!--cif->vhif_nvrs) {