The branch main has been updated by kp:

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

commit fa03d37432caf17d56a931a9e6f5d9b06f102c5b
Author:     Kristof Provost <[email protected]>
AuthorDate: 2023-08-29 09:33:17 +0000
Commit:     Kristof Provost <[email protected]>
CommitDate: 2023-08-31 10:16:20 +0000

    mcast: fix memory leak in imf_purge()
    
    The IGMP code buffers packets in the imf_inm->inm_scq mbufq, but does
    not clear this queue when struct in_mfilter is freed by imf_purge().
    This can cause memory leaks if IGMPv3 is used.
    
    Purge the mbufq on imf_purge().
    
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D41629
---
 sys/netinet/in_mcast.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c
index 827b8f96b07e..362e3f25115c 100644
--- a/sys/netinet/in_mcast.c
+++ b/sys/netinet/in_mcast.c
@@ -915,6 +915,8 @@ imf_purge(struct in_mfilter *imf)
        imf->imf_st[0] = imf->imf_st[1] = MCAST_UNDEFINED;
        KASSERT(RB_EMPTY(&imf->imf_sources),
            ("%s: imf_sources not empty", __func__));
+       if (imf->imf_inm != NULL)
+               mbufq_drain(&imf->imf_inm->inm_scq);
 }
 
 /*

Reply via email to