Page MenuHomeFreeBSD

mcast: fix memory leak in imf_purge()
ClosedPublic

Authored by kp on Aug 29 2023, 9:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 20, 10:30 AM
Unknown Object (File)
Tue, Dec 2, 10:20 AM
Unknown Object (File)
Mon, Dec 1, 8:12 PM
Unknown Object (File)
Sun, Nov 30, 5:48 AM
Unknown Object (File)
Tue, Nov 25, 3:18 PM
Unknown Object (File)
Nov 23 2025, 3:50 AM
Unknown Object (File)
Nov 18 2025, 2:50 AM
Unknown Object (File)
Nov 16 2025, 12:31 PM

Details

Summary

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")

Test Plan

Running this in a loop shows a steady increate in the mbuf zone, which goes away with this fix:

epair=$(ifconfig epair create)
epair=${epair%a}

ifconfig ${epair}a up
ifconfig ${epair}b up
ifconfig ${epair}a vhid 2 advbase 2 advskew 100 pass mekmitasdigoat alias 192.168.2.1/24

sleep 1
ifconfig ${epair}a destroy

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp requested review of this revision.Aug 29 2023, 9:47 AM
This revision was not accepted when it landed; it landed in state Needs Review.Aug 31 2023, 10:22 AM
This revision was automatically updated to reflect the committed changes.