git: 70fbe797c0f6 - stable/14 - mcast: fix memory leak in imf_purge()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 Sep 2023 19:27:03 UTC
The branch stable/14 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=70fbe797c0f6806d51708a9ef96ee02cb0c6d10d
commit 70fbe797c0f6806d51708a9ef96ee02cb0c6d10d
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:26: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
Approved by: re (gjb)
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 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);
}
/*