From febd0759f34e2faaaed0abf5fafb1071090aef38 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 12 Oct 2005 19:52:16 +0000 Subject: Change the reference counting to count the number of cloned interfaces for each cloner. This ensures that ifc->ifc_units is not prematurely freed in if_clone_detach() before the clones are destroyed, resulting in memory modified after free. This could be triggered with if_vlan. Assert that all cloners have been destroyed when freeing the memory. Change all simple cloners to destroy their clones with ifc_simple_destroy() on module unload so the reference count is properly updated. This also cleans up the interface destroy routines and allows future optimisation. Discussed with: brooks, pjd, -current Reviewed by: brooks --- sys/netinet/ip_carp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/netinet') diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 7dd72c17eb127..0e555434b6e89 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -2144,7 +2144,8 @@ carp_modevent(module_t mod, int type, void *data) case MOD_UNLOAD: if_clone_detach(&carp_cloner); while (!LIST_EMPTY(&carpif_list)) - carp_clone_destroy(SC2IFP(LIST_FIRST(&carpif_list))); + ifc_simple_destroy(&carp_cloner, + SC2IFP(LIST_FIRST(&carpif_list))); mtx_destroy(&carp_mtx); break; -- cgit v1.3