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)
Tue, Oct 1, 1:42 PM
Unknown Object (File)
Fri, Sep 27, 3:02 PM
Unknown Object (File)
Mon, Sep 23, 6:13 PM
Unknown Object (File)
Mon, Sep 23, 5:59 PM
Unknown Object (File)
Tue, Sep 17, 12:54 PM
Unknown Object (File)
Sat, Sep 14, 11:08 AM
Unknown Object (File)
Thu, Sep 12, 3:38 PM
Unknown Object (File)
Wed, Sep 4, 10:14 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.