Page MenuHomeFreeBSD

systat: Fix a bunch of use after frees in fetch_ifstat().
ClosedPublic

Authored by jhb on Sep 29 2022, 10:34 PM.
Tags
None
Referenced Files
F167775268: D36823.id113414.diff
Mon, Aug 24, 11:09 AM
Unknown Object (File)
Wed, Aug 12, 7:56 PM
Unknown Object (File)
Wed, Aug 12, 4:37 PM
Unknown Object (File)
Tue, Aug 11, 6:17 PM
Unknown Object (File)
Tue, Aug 11, 2:21 AM
Unknown Object (File)
Mon, Aug 10, 10:13 PM
Unknown Object (File)
Mon, Aug 10, 8:57 AM
Unknown Object (File)
Mon, Aug 10, 7:02 AM
Subscribers

Details

Summary

I think this was probably just a typo. initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by: GCC 12 -Wuse-after-free

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47637
Build 44524: arc lint + arc unit