From owner-svn-src-all@FreeBSD.ORG Wed Mar 18 14:01:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F8761065672; Wed, 18 Mar 2009 14:01:42 +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 07E808FC08; Wed, 18 Mar 2009 14:01:42 +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 n2IE1fue028186; Wed, 18 Mar 2009 14:01:41 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2IE1fU9028185; Wed, 18 Mar 2009 14:01:41 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <200903181401.n2IE1fU9028185@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Wed, 18 Mar 2009 14:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189962 - head/sys/netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2009 14:01:44 -0000 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); }