The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a11009dccb6a2e75de2b8f1b45a0896eda2e6d85

commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2021-03-08 17:39:05 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2021-03-08 17:39:05 +0000

    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
---
 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 cb2a88812855..c31a06992fe9 100644
--- a/sys/dev/if_wg/module/if_wg_session.c
+++ b/sys/dev/if_wg/module/if_wg_session.c
@@ -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) {
 
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to