svn commit: r196397 - head/sys/netinet

Will Andrews will at FreeBSD.org
Thu Aug 20 02:33:13 UTC 2009


Author: will
Date: Thu Aug 20 02:33:12 2009
New Revision: 196397
URL: http://svn.freebsd.org/changeset/base/196397

Log:
  Fix CARP memory leaks on carp_if's malloc'd using M_CARP.  This occurs when
  CARP tries to free them using M_IFADDR after the last address for a virtual
  host is removed and when detaching from the parent interface.
  
  Reviewed by:	mlaier
  Approved by:	re (kib), ken (mentor)

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==============================================================================
--- head/sys/netinet/ip_carp.c	Thu Aug 20 00:08:58 2009	(r196396)
+++ head/sys/netinet/ip_carp.c	Thu Aug 20 02:33:12 2009	(r196397)
@@ -501,7 +501,7 @@ carpdetach(struct carp_softc *sc, int un
 			ifpromisc(sc->sc_carpdev, 0);
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else if (unlock)
 			CARP_UNLOCK(cif);
 		sc->sc_carpdev = NULL;
@@ -1639,7 +1639,7 @@ carp_del_addr(struct carp_softc *sc, str
 		if (!--cif->vhif_nvrs) {
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else {
 			CARP_UNLOCK(cif);
 		}
@@ -1843,7 +1843,7 @@ carp_del_addr6(struct carp_softc *sc, st
 		if (!--cif->vhif_nvrs) {
 			CARP_LOCK_DESTROY(cif);
 			sc->sc_carpdev->if_carp = NULL;
-			free(cif, M_IFADDR);
+			free(cif, M_CARP);
 		} else
 			CARP_UNLOCK(cif);
 	}


More information about the svn-src-all mailing list