From owner-svn-src-stable-8@FreeBSD.ORG Fri Aug 19 13:41:00 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668931065672; Fri, 19 Aug 2011 13:41:00 +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 55B2D8FC21; Fri, 19 Aug 2011 13:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JDf09w005973; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JDf0ph005971; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201108191341.p7JDf0ph005971@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Fri, 19 Aug 2011 13:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225011 - stable/8/sys/netipsec X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:41:00 -0000 Author: vanhu Date: Fri Aug 19 13:41:00 2011 New Revision: 225011 URL: http://svn.freebsd.org/changeset/base/225011 Log: MFC: fixed two race conditions when inserting/removing SAs via PFKey, which can both lead to a kernel panic when adding/removing quickly a lot of SAs. Obtained from: NETASQ Modified: stable/8/sys/netipsec/key.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Fri Aug 19 13:34:05 2011 (r225010) +++ stable/8/sys/netipsec/key.c Fri Aug 19 13:41:00 2011 (r225011) @@ -2866,9 +2866,10 @@ key_newsav(m, mhp, sah, errp, where, tag sa_initref(newsav); newsav->state = SADB_SASTATE_LARVAL; - /* XXX locking??? */ + SAHTREE_LOCK(); LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav, secasvar, chain); + SAHTREE_UNLOCK(); done: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s from %s:%u return SP:%p\n", __func__, @@ -5712,8 +5713,8 @@ key_delete(so, m, mhp) } key_sa_chgstate(sav, SADB_SASTATE_DEAD); - SAHTREE_UNLOCK(); KEY_FREESAV(&sav); + SAHTREE_UNLOCK(); { struct mbuf *n;