aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2022-07-18 16:40:36 +0200
committerJohannes Berg <johannes.berg@intel.com>2022-07-22 14:27:48 +0200
commit1f6389440cebfbca40cc513da69c54b5c24381b1 (patch)
tree804114e468145debd30bc648e0d5f1e61a583d18 /net/mac80211
parentwifi: mac80211: fix NULL pointer deref with non-MLD STA (diff)
downloadlinux-dev-1f6389440cebfbca40cc513da69c54b5c24381b1.tar.xz
linux-dev-1f6389440cebfbca40cc513da69c54b5c24381b1.zip
wifi: mac80211: fix RX MLD address translation
We should only translate addr3 here if it's the BSSID. Fixes: 42fb9148c078 ("wifi: mac80211: do link->MLD address translation on RX") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/rx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index cad4b2378218..9054a1e0b0d8 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -4776,10 +4776,14 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
ether_addr_copy(hdr->addr1, rx->sdata->vif.addr);
if (ether_addr_equal(link_sta->addr, hdr->addr2))
ether_addr_copy(hdr->addr2, rx->sta->addr);
- if (ether_addr_equal(link_sta->addr, hdr->addr3))
- ether_addr_copy(hdr->addr3, rx->sta->addr);
- else if (ether_addr_equal(link->conf->addr, hdr->addr3))
- ether_addr_copy(hdr->addr3, rx->sdata->vif.addr);
+ /* translate A3 only if it's the BSSID */
+ if (!ieee80211_has_tods(hdr->frame_control) &&
+ !ieee80211_has_fromds(hdr->frame_control)) {
+ if (ether_addr_equal(link_sta->addr, hdr->addr3))
+ ether_addr_copy(hdr->addr3, rx->sta->addr);
+ else if (ether_addr_equal(link->conf->addr, hdr->addr3))
+ ether_addr_copy(hdr->addr3, rx->sdata->vif.addr);
+ }
/* not needed for A4 since it can only carry the SA */
}