HomeFreeBSD

netlink: fix accessing freed memory

Description

netlink: fix accessing freed memory

The check for if_addrlen in dump_iface() is not sufficient to determine
if we still have a valid if_addr. Rather than directly accessing if_addr
check the STAILQ (for the first entry).
This avoids panics when destroying cloned interfaces as experienced with
net80211 wlan ones.

Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
Reviewed by: jhibbits (earlier version), kp
Differential Revision: https://reviews.freebsd.org/D42027

(cherry picked from commit 7d48224073ce14f0dd3db2d4e96876ac928b52f2)
(cherry picked from commit 8bda9f9c56a997d851e8fc2c20b5e37f072ecb4a)

Details

Provenance
bzAuthored on Sep 30 2023, 3:11 PM
Reviewer
jhibbits
Differential Revision
D42027: netlink: fix accessing freed memory
Parents
rGbf1c8af905f1: iwlwifi / rtw88: re-attach to build after updates
Branches
Unknown
Tags
Unknown