From owner-svn-src-stable@FreeBSD.ORG Thu May 14 07:32:33 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C33341065670; Thu, 14 May 2009 07:32:33 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B007E8FC1A; Thu, 14 May 2009 07:32:33 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4E7WX3v080801; Thu, 14 May 2009 07:32:33 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4E7WXpn080800; Thu, 14 May 2009 07:32:33 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200905140732.n4E7WXpn080800@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Thu, 14 May 2009 07:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192088 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb netipsec X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 07:32:34 -0000 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); }