git: fb3854845f50 - main - mroute: fix memory leak

From: Wojciech Macek <wma_at_FreeBSD.org>
Date: Thu, 28 Oct 2021 05:12:36 UTC
The branch main has been updated by wma:

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

commit fb3854845f500155982355a39d1d32ccc9a44c16
Author:     Wojciech Macek <wma@FreeBSD.org>
AuthorDate: 2021-10-28 04:41:15 +0000
Commit:     Wojciech Macek <wma@FreeBSD.org>
CommitDate: 2021-10-28 05:12:16 +0000

    mroute: fix memory leak
    
    Add MFC to linked list to store incoming packets
    before MCAST JOIN was captured.
    
    Sponsored by:           Stormshield
    Obtained from:          Semihalf
    MFC after:              2 weeks
---
 sys/netinet/ip_mroute.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index efb34af60d9c..c992743a503e 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1466,6 +1466,9 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
 		timevalclear(&rt->mfc_last_assert);
 
 		buf_ring_enqueue(rt->mfc_stall_ring, rte);
+
+		/* Add RT to hashtable as it didn't exist before */
+		LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash);
 	} else {
 		/* determine if queue has overflowed */
 		if (buf_ring_full(rt->mfc_stall_ring)) {