Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2009 07:32:33 +0000 (UTC)
From:      VANHULLEBUS Yvan <vanhu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r192088 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec
Message-ID:  <200905140732.n4E7WXpn080800@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vanhu
Date: Thu May 14 07:32:33 2009
New Revision: 192088
URL: http://svn.freebsd.org/changeset/base/192088

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

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/netipsec/key.c

Modified: stable/7/sys/netipsec/key.c
==============================================================================
--- stable/7/sys/netipsec/key.c	Thu May 14 06:50:30 2009	(r192087)
+++ stable/7/sys/netipsec/key.c	Thu May 14 07:32:33 2009	(r192088)
@@ -2654,7 +2654,12 @@ 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++;
@@ -4086,6 +4091,7 @@ 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 > key_larval_lifetime)
 				KEY_FREESAV(&sav);
 		}



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