Commit a11009dc authored by Mark Johnston's avatar Mark Johnston
Browse files

wg: Avoid leaking mbufs when the input handshake queue is full

Reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29011
parent af06ff55
......@@ -1913,6 +1913,7 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb,
*/
if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) {
DPRINTF(sc, "DEFRAG fail\n");
m_freem(m0);
return;
}
data = mtod(m, void *);
......@@ -1943,8 +1944,10 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb,
verify_endpoint(m);
if (mbufq_enqueue(&sc->sc_handshake_queue, m) == 0) {
GROUPTASK_ENQUEUE(&sc->sc_handshake);
} else
} else {
DPRINTF(sc, "Dropping handshake packet\n");
wg_m_freem(m);
}
} else if (pktlen >= sizeof(struct wg_pkt_data) + NOISE_MAC_SIZE
&& pkttype == MESSAGE_DATA) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment