Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 09:44:14 +0000 (UTC)
From:      VANHULLEBUS Yvan <vanhu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192882 - head/sys/netipsec
Message-ID:  <200905270944.n4R9iEsI090159@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vanhu
Date: Wed May 27 09:44:14 2009
New Revision: 192882
URL: http://svn.freebsd.org/changeset/base/192882

Log:
  Lock SPTREE before parsing it in key_spddump()
  
  Approved by:	gnn(mentor)
  Obtained from:	NETASQ
  MFC after:	2 weeks

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Wed May 27 09:41:58 2009	(r192881)
+++ head/sys/netipsec/key.c	Wed May 27 09:44:14 2009	(r192882)
@@ -2396,14 +2396,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, &V_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, &V_sptree[dir], chain) {
@@ -2416,6 +2419,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?200905270944.n4R9iEsI090159>