]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: check ieee80211_rx_data_set_link return in pubsta MLO path
authorMichael Bommarito <michael.bommarito@gmail.com>
Wed, 22 Apr 2026 00:06:51 +0000 (20:06 -0400)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 27 Apr 2026 10:41:33 +0000 (12:41 +0200)
__ieee80211_rx_handle_packet() resolves the link via
ieee80211_rx_data_set_link() on the pubsta->mlo path but ignores the
helper's return value.  Inside the helper,
  rx->link = rcu_dereference(rx->sdata->link[link_id]);
can leave rx->link NULL if link_id references a slot already cleared
by ieee80211_vif_set_links() during station-initiated ML
reconfiguration (see mlme.c's ieee80211_ml_reconfiguration(), which
invalidates sdata->link[] before the matching
ieee80211_sta_remove_link() loop walks the link-sta hash).  RX dispatch
still resolves a link_sta from the hash and then drops into
ieee80211_prepare_and_rx_handle(), which dereferences link->conf->addr.

Every other user site of ieee80211_rx_data_set_link() checks the return
and bails on failure; only this branch did not.  Mirror the safe
pattern.

Fixes: e66b7920aa5a ("wifi: mac80211: fix initialization of rx->link and rx->link_sta")
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
Link: https://patch.msgid.link/20260422000651.4184602-1-michael.bommarito@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index 3e5d1c47a5b067708d27163cc97b70734c0b1957..5a92413a911f2d77b9c9d70d49082cf23fc3a2da 100644 (file)
@@ -5380,7 +5380,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
                                if (!link_sta)
                                        goto out;
 
-                               ieee80211_rx_data_set_link(&rx, link_sta->link_id);
+                               if (!ieee80211_rx_data_set_link(&rx,
+                                                               link_sta->link_id))
+                                       goto out;
                        }
 
                        if (ieee80211_prepare_and_rx_handle(&rx, skb, true))