Date: Thu, 11 Mar 2021 16:43:39 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 11d845713834 - releng/13.0 - wg: Avoid leaking mbufs when the input handshake queue is full Message-ID: <202103111643.12BGhdOI084902@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=11d8457138346e9f474b789ed83ff061ea8caf75 commit 11d8457138346e9f474b789ed83ff061ea8caf75 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-03-11 15:58:35 +0000 wg: Avoid leaking mbufs when the input handshake queue is full Approved by: re Reviewed by: grehan Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29011 (cherry picked from commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85) (cherry picked from commit 47495bf648a3394383eec64cbff4f3527e76f690) --- sys/dev/if_wg/module/if_wg_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 084bc789039d..4164a531cc69 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1907,6 +1907,7 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); + m_freem(m0); return; } data = mtod(m, void *); @@ -1937,8 +1938,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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103111643.12BGhdOI084902>