diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-09-01 16:33:24 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-09-01 16:33:24 +0000 |
| commit | c8a5df48de6f2c5fada622af043f3c3fca88fca1 (patch) | |
| tree | 56a9bbc503d1b6f7f9dbcf511cfa0051591f3151 | |
| parent | 9764aa1ccad08a7ec53ed9b80741b9553f3fa4e6 (diff) | |
udp: don't leak mbuf if tunnel didn't consume and inpcb is gone
Fixes: e1751ef896119d7372035b1b60f18a6342bd0e3b
Reviewed by: tuexen, kp, markj
Differential Revision: https://reviews.freebsd.org/D52170
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 3e6519118a40..4547699b6df5 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -258,8 +258,11 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, filtered = (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&udp_in[0], up->u_tun_ctx); INP_RLOCK(inp); - if (in_pcbrele_rlocked(inp)) + if (in_pcbrele_rlocked(inp)) { + if (!filtered) + m_freem(n); return (1); + } if (filtered) { INP_RUNLOCK(inp); return (1); |
