Check that we have PF_KEY sockets before iterating over all RAW sockets.

MFC after:	2 weeks
This commit is contained in:
ae 2018-03-11 18:10:59 +00:00
parent a0388b5a24
commit 1629f3ec27

View File

@ -202,6 +202,11 @@ key_sendup_mbuf(struct socket *so, struct mbuf *m, int target)
PFKEYSTAT_INC(in_msgtype[msg->sadb_msg_type]);
}
mtx_lock(&rawcb_mtx);
if (V_key_cb.any_count == 0) {
mtx_unlock(&rawcb_mtx);
m_freem(m);
return (0);
}
LIST_FOREACH(rp, &V_rawcb_list, list)
{
if (rp->rcb_proto.sp_family != PF_KEY)