From: Johannes Berg In mac80211 the deflink link IDs for non-MLO are set to zero to match the array index where their pointer lives. However, the rx->link_id is expected to be -1 in these cases, so just mapping it to the link/sta_link link_id broke a few things such as reporting of spurious 4-addr frames. Set the link ID to -1 in these cases. Reported-by: Jouni Malinen Fixes: 6d531b9af16e ("wifi: mac80211: rework RX packet handling") Signed-off-by: Johannes Berg --- net/mac80211/rx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index f5893f9c07c6..804a0dc1e35c 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -4345,7 +4345,10 @@ static bool ieee80211_rx_data_set_link_sta(struct ieee80211_rx_data *rx, if (!rx->link) return false; - rx->link_id = rx->link->link_id; + if (ieee80211_vif_is_mld(&sta->sdata->vif)) + rx->link_id = rx->link->link_id; + else + rx->link_id = -1; rx->link_sta = link_sta; return true; @@ -5292,6 +5295,7 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, struct ieee80211_fast_rx *fast_rx; struct ieee80211_rx_data rx; struct sta_info *sta; + int link_id = -1; memset(&rx, 0, sizeof(rx)); rx.skb = skb; @@ -5308,11 +5312,11 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw, goto drop; sta = container_of(link_pubsta->sta, struct sta_info, sta); - if (!ieee80211_rx_data_set_sta(&rx, sta, link_pubsta->link_id)) + if (sta->sta.valid_links) + link_id = link_pubsta->link_id; + if (!ieee80211_rx_data_set_sta(&rx, sta, link_id)) goto drop; - rx.link_id = link_pubsta->link_id; - fast_rx = rcu_dereference(rx.sta->fast_rx); if (!fast_rx) goto drop; @@ -5575,7 +5579,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, rx.sdata = sdata; rx.local = sdata->local; rx.link = link; - rx.link_id = link->link_id; + rx.link_id = link != &sdata->deflink ? link->link_id : -1; rx.sta = NULL; rx.link_sta = NULL; -- 2.55.0