git: 6c77f8f0e0d8 - main - if_ovpn: handle m_pullup() failure

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 01 Jul 2022 08:07:53 UTC
The branch main has been updated by kp:

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

commit 6c77f8f0e0d8e7984c47ea4d234b724ddd56bb84
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-06-30 18:11:52 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-07-01 08:02:32 +0000

    if_ovpn: handle m_pullup() failure
    
    Ensure we correctly handle m_pullup() failing in ovpn_finish_rx().
    
    Reported by:    Coverity (CID 1490340)
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/net/if_ovpn.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c
index 87798c974442..9430d1cebe56 100644
--- a/sys/net/if_ovpn.c
+++ b/sys/net/if_ovpn.c
@@ -1441,6 +1441,10 @@ ovpn_finish_rx(struct ovpn_softc *sc, struct mbuf *m,
 
 	/* Ensure we can read the first byte. */
 	m = m_pullup(m, 1);
+	if (m == NULL) {
+		OVPN_COUNTER_ADD(sc, nomem_data_pkts_in, 1);
+		return;
+	}
 
 	/*
 	 * Check for address family, and disregard any control packets (e.g.