diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-22 23:25:16 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-22 23:25:16 +0000 |
commit | 196832ded10fbdbcaa4c8e0bfd5b97dcd43b7cc9 (patch) | |
tree | 9a9034ec527c8ef2aa3602da01a00b01d90fc187 | |
parent | cf376344d05470c4531028d23c1f50df3247a9d7 (diff) |
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.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_carp.c | 7 |
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) { |