aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2022-07-12 12:19:25 +0000
committerKristof Provost <kp@FreeBSD.org>2022-07-12 12:19:25 +0000
commit59219dde9a7b5e33cb95e55d4621bd50b3dca37b (patch)
tree33bf2aa347a3a33b5b70a39d6835346fe7626f8e
parent7e06f4708cbe8a8ace21d6629cb4b9c8c9340152 (diff)
downloadsrc-59219dde9a7b5e33cb95e55d4621bd50b3dca37b.tar.gz
src-59219dde9a7b5e33cb95e55d4621bd50b3dca37b.zip
if_ovpn: fix mbuf leak
If the link is down or we can't find a peer we do not transmit the packet, but also don't fee it. Remember to m_freem() mbufs we can't transmit. Sponsored by: Rubicon Communications, LLC ("Netgate")
-rw-r--r--sys/net/if_ovpn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c
index 779d51075e3d..0f700a9b43d0 100644
--- a/sys/net/if_ovpn.c
+++ b/sys/net/if_ovpn.c
@@ -1988,6 +1988,7 @@ ovpn_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
if (__predict_false(ifp->if_link_state != LINK_STATE_UP)) {
OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1);
OVPN_RUNLOCK(sc);
+ m_freem(m);
return (ENETDOWN);
}
@@ -2005,6 +2006,7 @@ ovpn_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
/* No destination. */
OVPN_COUNTER_ADD(sc, lost_data_pkts_out, 1);
OVPN_RUNLOCK(sc);
+ m_freem(m);
return (ENETDOWN);
}