In ieee80211_prep_connection() with assoc set, the station obtained by sta_info_get() is owned by this flow for MLO and must not survive a failed connection prep: on failure the interface is reset to non-MLD, and a station tied to the torn-down link triggers the use-after-free/double-free on debugfs recreation fixed by commit 283fc9e44ff5 ("wifi: mac80211: remove station if connection prep fails"). That commit put the station destroy in out_err, but the ieee80211_vif_set_links() error path returns before out_err, so a set_links failure still leaves the station behind and keeps that bug reachable. Route the failure through out_err like the later error paths do; its extra ieee80211_vif_set_links(sdata, 0, 0) is the function's established unwind. Found by static analysis. Fixes: 283fc9e44ff5 ("wifi: mac80211: remove station if connection prep fails") Signed-off-by: Chengyu Liu --- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 3c31c16860..24fbdaabff 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -9633,7 +9633,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, err = ieee80211_vif_set_links(sdata, new_links, 0); if (err) - return err; + goto out_err; link = sdata_dereference(sdata->link[link_id], sdata); if (WARN_ON(!link)) { -- 2.25.1