Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2009 14:01:41 +0000 (UTC)
From:      VANHULLEBUS Yvan <vanhu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r189962 - head/sys/netipsec
Message-ID:  <200903181401.n2IE1fU9028185@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vanhu
Date: Wed Mar 18 14:01:41 2009
New Revision: 189962
URL: http://svn.freebsd.org/changeset/base/189962

Log:
  Fixed deletion of sav entries in key_delsah()
  
  Approved by:	gnn(mentor)
  Obtained from:	NETASQ
  MFC after:	1 month

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Wed Mar 18 13:54:35 2009	(r189961)
+++ head/sys/netipsec/key.c	Wed Mar 18 14:01:41 2009	(r189962)
@@ -2687,7 +2687,10 @@ key_delsah(sah)
 			if (sav->refcnt == 0) {
 				/* sanity check */
 				KEY_CHKSASTATE(state, sav->state, __func__);
-				KEY_FREESAV(&sav);
+				/* do NOT call KEY_FREESAV here: it will only delete the sav if refcnt == 1,
+				 * where we already know that refcnt == 0
+				 */
+				key_delsav(sav);
 			} else {
 				/* give up to delete this sa */
 				zombie++;
@@ -4131,6 +4134,8 @@ key_flush_sad(time_t now)
 
 		/* if LARVAL entry doesn't become MATURE, delete it. */
 		LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_LARVAL], chain, nextsav) {
+			/* Need to also check refcnt for a larval SA ???
+			 */
 			if (now - sav->created > V_key_larval_lifetime)
 				KEY_FREESAV(&sav);
 		}



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