HomeFreeBSD

vlan: plug a new panic associated with interface removal

Description

vlan: plug a new panic associated with interface removal

The ac6a7f621668 enabled execution of vlan_clone_dump_nl(), which
previously was effectively disabled. The function itself was added back
in 089104e0e01f0. This exposed a bug when Netlink dumps info on all
interfaces using a dangerous KPI if_foreach_sleep(), which may call its
callbacks on completely detached interfaces, hanging on the last
reference. The ifc_dump_ifp_nl_default() is able to digest such interface
without a panic, but vlan_clone_dump_nl() can't. Neither of the above
revisions is the actual culprit, rather it is design problem of detaching
interfaces and if_foreach_sleep().

Plug the problem with removing pointer to freed memory on detach and
making a NULL check later.

Reported by: pho

Details

Provenance
glebiusAuthored on Wed, Dec 17, 9:05 PM
Parents
rG0bf42a0a05b9: bpf: virtualize bpf_iflist
Branches
Unknown
Tags
Unknown