summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2012-10-08 18:33:24 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2012-10-08 18:33:24 +0000
commit5e089a91cb1949251f5810ccdfcb64d8102ef5ea (patch)
tree44471cac87920ef09452004bf977a68af43f632f /sys/net
parenta6c34e25b98e1f3eb0863b308e663e6e962557a5 (diff)
make sure we don't call hook_disestablish() twice e.g. ifconfig -syncdev
followed by ifconfig destroy; ok mikeb
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_pfsync.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 5086ac8279b..972acb1bc12 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.192 2012/09/20 17:37:47 mikeb Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.193 2012/10/08 18:33:23 markus Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -366,10 +366,12 @@ pfsync_clone_destroy(struct ifnet *ifp)
if (sc->sc_link_demoted)
carp_group_demote_adj(&sc->sc_if, -1, "pfsync destroy");
#endif
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
if_detach(ifp);
pfsync_drop(sc);
@@ -1349,10 +1351,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sc->sc_defer = pfsyncr.pfsyncr_defer;
if (pfsyncr.pfsyncr_syncdev[0] == 0) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
if (imo->imo_num_memberships > 0) {
in_delmulti(imo->imo_membership[
@@ -1385,10 +1389,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct in_addr addr;
if (!(sc->sc_sync_if->if_flags & IFF_MULTICAST)) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
splx(s);
return (EADDRNOTAVAIL);
@@ -1398,10 +1404,12 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((imo->imo_membership[0] =
in_addmulti(&addr, sc->sc_sync_if)) == NULL) {
- if (sc->sc_lhcookie != NULL)
+ if (sc->sc_lhcookie != NULL) {
hook_disestablish(
sc->sc_sync_if->if_linkstatehooks,
sc->sc_lhcookie);
+ sc->sc_lhcookie = NULL;
+ }
sc->sc_sync_if = NULL;
splx(s);
return (ENOBUFS);