Re: [PATCH] wifi: mac80211_hwsim: remove radios from rhashtable before freeing

From: Johannes Berg

Date: Mon Jul 06 2026 - 07:38:31 EST


On Sat, 2026-06-20 at 00:24 +0800, Cen Zhang wrote:
> mac80211_hwsim_new_radio() publishes each registered radio on the
> hwsim_radios list and in hwsim_radios_rht. The generic-netlink and
> virtio command paths use the rhashtable to find radios by address.
>
> Most radio removal paths remove the hash entry while holding
> hwsim_radio_lock before unregistering and freeing the radio. However,
> mac80211_hwsim_free() only removes the list entry. During init error
> unwinding after hwsim netlink and virtio registration, this can leave a
> freed radio reachable from hwsim_radios_rht until the callback surfaces
> are unpublished and the rhashtable is destroyed.

How does the init even fail? I think this is fairly contrived,
especially in a test tool. The whole thing is maybe worth a cleanup, but
the whole scary commit message is nonsense.

johannes