Page MenuHomeFreeBSD

fix leak of the ifg_list structure in if_delgroups.
AbandonedPublic

Authored by jacob.e.keller_intel.com on Nov 1 2019, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 21 2024, 9:10 AM
Unknown Object (File)
Feb 19 2024, 9:59 AM
Unknown Object (File)
Dec 20 2023, 2:30 AM
Unknown Object (File)
Dec 10 2023, 9:58 PM
Unknown Object (File)
Nov 9 2023, 7:15 AM
Unknown Object (File)
Sep 15 2023, 10:26 PM
Unknown Object (File)
Sep 6 2023, 2:54 AM
Unknown Object (File)
Aug 19 2023, 4:57 PM
Subscribers

Details

Reviewers
jhb
gallatin
erj
Group Reviewers
Intel Networking
Summary

The ifg_list and ifg_member structures are allocated on M_TEMP in
if_addgroup. The ifg_list pointer is properly released in if_delgroup,
but not in if_delgroups.

Fix if_delgroups to release the ifgl pointer as well as the ifgm
pointer, so that we do not leak memory when detaching an interface.

An alternative fix might be to factor out logic for actually freeing the
group memory into a separate function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27308
Build 25566: arc lint + arc unit

Event Timeline

This is the simpler straight forward fix to the same issue described in https://reviews.freebsd.org/D22214

Also, yay.. yet another memory leak fixed while playing whack-a-mole trying to fix leaks during driver load/unload testing. I think we still have at least one more on M_IFADDR somewhere.

I think the refactored version to avoid code duplication is probably a better fix. If you go with this one, perhaps remove the whitespace changes and only commit the added free().

I think the refactored version to avoid code duplication is probably a better fix. If you go with this one, perhaps remove the whitespace changes and only commit the added free().

Lets just go with the refactor, after adding a lock assert.

We're in agreement that the refactor is a better solution, so I'm going to abandon this one.