In member interface detach event handler, do not attempt to free state

which has already been freed by in_ifdetach(). With this cumulative change,
the removal of a member interface will not cause a panic in pfsync(4).

Requested by:	yar
PR:		86848
This commit is contained in:
Bruce M Simpson 2007-04-14 01:01:46 +00:00
parent 24b0502ee0
commit 05d91e4363
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168700

View File

@ -1905,7 +1905,15 @@ pfsync_ifdetach(void *arg, struct ifnet *ifp)
}
imo = &sc->sc_imo;
if (imo->imo_num_memberships > 0) {
in_delmulti(imo->imo_membership[--imo->imo_num_memberships]);
KASSERT(imo->imo_num_memberships == 1,
("%s: imo_num_memberships != 1", __func__));
/*
* Our event handler is always called after protocol
* domains have been detached from the underlying ifnet.
* Do not call in_delmulti(); we held a single reference
* which the protocol domain has purged in in_purgemaddrs().
*/
imo->imo_membership[--imo->imo_num_memberships] = NULL;
imo->imo_multicast_ifp = NULL;
}