Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2009 13:17:05 +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: r194236 - in stable/7/sys: . contrib/pf dev/ath/ath_hal netipsec
Message-ID:  <200906151317.n5FDH5cE090678@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vanhu
Date: Mon Jun 15 13:17:05 2009
New Revision: 194236
URL: http://svn.freebsd.org/changeset/base/194236

Log:
  MFC: Lock SPTREE before parsing it in key_spddump()
  
  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/netipsec/key.c

Modified: stable/7/sys/netipsec/key.c
==============================================================================
--- stable/7/sys/netipsec/key.c	Mon Jun 15 07:24:16 2009	(r194235)
+++ stable/7/sys/netipsec/key.c	Mon Jun 15 13:17:05 2009	(r194236)
@@ -2363,14 +2363,17 @@ key_spddump(so, m, mhp)
 
 	/* search SPD entry and get buffer size. */
 	cnt = 0;
+	SPTREE_LOCK();
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
 		LIST_FOREACH(sp, &sptree[dir], chain) {
 			cnt++;
 		}
 	}
 
-	if (cnt == 0)
+	if (cnt == 0) {
+		SPTREE_UNLOCK();
 		return key_senderror(so, m, ENOENT);
+	}
 
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
 		LIST_FOREACH(sp, &sptree[dir], chain) {
@@ -2383,6 +2386,7 @@ key_spddump(so, m, mhp)
 		}
 	}
 
+	SPTREE_UNLOCK();
 	m_freem(m);
 	return 0;
 }



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