Page MenuHomeFreeBSD

if_vxlan(4): Plug a memory leak
ClosedPublic

Authored by zlei on Jul 1 2024, 12:47 PM.
Tags
None
Referenced Files
F142191044: D45822.id.diff
Sat, Jan 17, 12:50 AM
F142173421: D45822.id.diff
Fri, Jan 16, 7:23 PM
F142167932: D45822.id140424.diff
Fri, Jan 16, 5:14 PM
Unknown Object (File)
Fri, Jan 16, 6:37 AM
Unknown Object (File)
Sat, Dec 27, 8:57 AM
Unknown Object (File)
Dec 3 2025, 7:05 PM
Unknown Object (File)
Nov 29 2025, 9:04 AM
Unknown Object (File)
Nov 24 2025, 1:16 PM

Details

Summary

On clone creating, either failure from vxlan_set_user_config() or
ifc_copyin() will result in leaking previous allocated counters.

Since counter_u64_alloc(M_WAITOK) never fails, make vxlan_stats_alloc()
void and move the allocation for counters below checking ifd->params to
avoid memory leak.

Fixes: b092fd6c973d if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS
MFC after: 1 week

Diff Detail

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

Event Timeline

zlei requested review of this revision.Jul 1 2024, 12:47 PM
kp added a subscriber: kp.
kp added inline comments.
sys/net/if_vxlan.c
2955

counter_u64_free(NULL) is safe (now), so even without the other changes getting rid of the check would be fine.

This revision is now accepted and ready to land.Jul 1 2024, 4:01 PM
zlei marked an inline comment as done.Jul 2 2024, 4:53 AM
zlei added inline comments.
sys/net/if_vxlan.c
2955

Indeed.

This revision was automatically updated to reflect the committed changes.
zlei marked an inline comment as done.