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)
Feb 20 2025, 1:01 PM
Unknown Object (File)
Feb 5 2025, 2:20 AM
Unknown Object (File)
Jan 26 2025, 6:14 PM
Unknown Object (File)
Jan 24 2025, 9:50 PM
Unknown Object (File)
Jan 24 2025, 8:01 PM
Unknown Object (File)
Jan 24 2025, 4:57 PM
Unknown Object (File)
Nov 26 2024, 9:25 PM
Unknown Object (File)
Nov 20 2024, 5:22 AM

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.