Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Mar 2010 06:51:50 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205789 - head/sys/netipsec
Message-ID:  <201003280651.o2S6po7B030061@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Sun Mar 28 06:51:50 2010
New Revision: 205789
URL: http://svn.freebsd.org/changeset/base/205789

Log:
  When tearing down IPsec as part of a (virtual) network stack,
  do not try to free the same list twice but free both the
  acquiring list and the security policy acquiring list.
  
  Reviewed by:	anchie
  MFC after:	3 days

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Sun Mar 28 03:00:18 2010	(r205788)
+++ head/sys/netipsec/key.c	Sun Mar 28 06:51:50 2010	(r205789)
@@ -7779,7 +7779,8 @@ void
 key_destroy(void)
 {
 	struct secpolicy *sp, *nextsp;
-	struct secspacq *acq, *nextacq;
+	struct secacq *acq, *nextacq;
+	struct secspacq *spacq, *nextspacq;
 	struct secashead *sah, *nextsah;
 	struct secreg *reg;
 	int i;
@@ -7820,7 +7821,7 @@ key_destroy(void)
 	REGTREE_UNLOCK();
 
 	ACQ_LOCK();
-	for (acq = LIST_FIRST(&V_spacqtree); acq != NULL; acq = nextacq) {
+	for (acq = LIST_FIRST(&V_acqtree); acq != NULL; acq = nextacq) {
 		nextacq = LIST_NEXT(acq, chain);
 		if (__LIST_CHAINED(acq)) {
 			LIST_REMOVE(acq, chain);
@@ -7830,11 +7831,12 @@ key_destroy(void)
 	ACQ_UNLOCK();
 
 	SPACQ_LOCK();
-	for (acq = LIST_FIRST(&V_spacqtree); acq != NULL; acq = nextacq) {
-		nextacq = LIST_NEXT(acq, chain);
-		if (__LIST_CHAINED(acq)) {
-			LIST_REMOVE(acq, chain);
-			free(acq, M_IPSEC_SAQ);
+	for (spacq = LIST_FIRST(&V_spacqtree); spacq != NULL;
+	    spacq = nextspacq) {
+		nextspacq = LIST_NEXT(spacq, chain);
+		if (__LIST_CHAINED(spacq)) {
+			LIST_REMOVE(spacq, chain);
+			free(spacq, M_IPSEC_SAQ);
 		}
 	}
 	SPACQ_UNLOCK();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003280651.o2S6po7B030061>