ieee80211_tdls_mgmt_setup() keeps the peer of a TDLS setup in sdata->u.mgd.tdls_peer and queues tdls_peer_del_work, which destroys the station with that address unless the setup completes within TDLS_PEER_SETUP_TIMEOUT. The address survives a disconnect and the work does not check that the station is a TDLS peer, so a setup sent to the address of another AP destroys that AP's station if the interface associates with it in the meantime. ieee80211_set_disassoc() then finds no AP station and returns early, and conn_mon_timer and bcn_mon_timer are still armed when the interface is freed: WARNING: net/mac80211/mlme.c:4531 at ieee80211_set_disassoc+0x15bb/0x1c50 ieee80211_mgd_deauth.cold (net/mac80211/mlme.c:10842) cfg80211_mlme_deauth (net/wireless/rdev-ops.h:551 net/wireless/mlme.c:581) cfg80211_disconnect (net/wireless/sme.c:666 net/wireless/sme.c:1582) ... BUG: KASAN: use-after-free in __run_timers (include/linux/list.h:1047 kernel/time/timer.c:892 kernel/time/timer.c:1783 kernel/time/timer.c:2375) Write of size 8 at addr ff11000012d19b08 by task swapper/0/0 __run_timers (include/linux/list.h:1047 kernel/time/timer.c:892 kernel/time/timer.c:1783 kernel/time/timer.c:2375) timer_expire_remote (kernel/time/timer.c:2387 kernel/time/timer.c:2379 kernel/time/timer.c:2137) tmigr_handle_remote_up (kernel/time/timer_migration.c:985 kernel/time/timer_migration.c:1076) run_timer_softirq (kernel/time/timer.c:2410) handle_softirqs (kernel/softirq.c:669) Only destroy the station if it is a TDLS peer, as commit 6f0a100df853 ("wifi: mac80211: only operate on TDLS peers in the TDLS code") does in the other TDLS paths. Fixes: 17e6a59a365a ("mac80211: cleanup TDLS state during failed setup") Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Kyuwon Cho --- The issue was found by an LLM-guided test generator that we are developing as a research prototype. We reproduce it with mac80211_hwsim radios in a user and network namespace: the station connects to AP A, sends a failing TDLS setup request to the address of AP B, and connects to B. Without the patch, B's station is gone 16 seconds later, the next disconnect warns as above, and KASAN reports the use-after-free a few seconds after the station interface is deleted. With it, the AP station stays and neither shows up. The reproducer is available on request. Found and tested on mainline 9437ee8b6cf6 (v7.4-rc4-571, with KASAN); the code is the same in wireless (35c42b20ac87), where the patch applies as is. net/mac80211/tdls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 8ae01c277fd2..b260513858a2 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -33,8 +33,11 @@ void ieee80211_tdls_peer_del_work(struct wiphy *wiphy, struct wiphy_work *wk) lockdep_assert_wiphy(local->hw.wiphy); if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer)) { + struct sta_info *sta = sta_info_get(sdata, sdata->u.mgd.tdls_peer); + tdls_dbg(sdata, "TDLS del peer %pM\n", sdata->u.mgd.tdls_peer); - sta_info_destroy_addr(sdata, sdata->u.mgd.tdls_peer); + if (sta && sta->sta.tdls) + sta_info_destroy_addr(sdata, sdata->u.mgd.tdls_peer); eth_zero_addr(sdata->u.mgd.tdls_peer); } } -- 2.43.0