git: 55be69175311 - stable/13 - mcast: fix memory leak in imf_purge()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 Sep 2023 19:25:03 UTC
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=55be6917531157259d273cc5e698e797865dd0b4 commit 55be6917531157259d273cc5e698e797865dd0b4 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-08-29 09:33:17 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-09-07 19:23:07 +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 (cherry picked from commit fa03d37432caf17d56a931a9e6f5d9b06f102c5b) --- 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 da5a23541c17..a78363da43e0 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -920,6 +920,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); } /*