1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Locks SPTREE when setting some SP entries to state DEAD.

This can prevent kernel panics when updating SPs while
there is some traffic for them.

Obtained from: NETASQ
MFC after: 1m
This commit is contained in:
VANHULLEBUS Yvan 2010-04-15 12:40:33 +00:00
parent 94410af774
commit 61f73308d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206659

View File

@ -1882,7 +1882,9 @@ key_spdadd(so, m, mhp)
newsp = key_getsp(&spidx);
if (mhp->msg->sadb_msg_type == SADB_X_SPDUPDATE) {
if (newsp) {
SPTREE_LOCK();
newsp->state = IPSEC_SPSTATE_DEAD;
SPTREE_UNLOCK();
KEY_FREESP(&newsp);
}
} else {
@ -2117,7 +2119,9 @@ key_spddelete(so, m, mhp)
/* save policy id to buffer to be returned. */
xpl0->sadb_x_policy_id = sp->id;
SPTREE_LOCK();
sp->state = IPSEC_SPSTATE_DEAD;
SPTREE_UNLOCK();
KEY_FREESP(&sp);
{
@ -2184,7 +2188,9 @@ key_spddelete2(so, m, mhp)
return key_senderror(so, m, EINVAL);
}
SPTREE_LOCK();
sp->state = IPSEC_SPSTATE_DEAD;
SPTREE_UNLOCK();
KEY_FREESP(&sp);
{