svn commit: r192088 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec

VANHULLEBUS Yvan vanhu at FreeBSD.org
Thu May 14 07:32:34 UTC 2009


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);
 		}


More information about the svn-src-stable-7 mailing list