Lock SPTREE before parsing it in key_spddump()

Approved by:	gnn(mentor)
Obtained from:	NETASQ
MFC after:	2 weeks
This commit is contained in:
VANHULLEBUS Yvan 2009-05-27 09:44:14 +00:00
parent 81fee06f9c
commit aa1faa5fc6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192882

View File

@ -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;
}