summaryrefslogtreecommitdiff
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2022-07-18 09:14:30 +0200
committerJohannes Berg <johannes.berg@intel.com>2022-07-22 14:27:47 +0200
commit206c8c0680b15d2630900ca27eb971c5d25557e8 (patch)
tree18b873381272941f08983c1a6b500be7ab3ad2bd /net/mac80211/cfg.c
parent553a282cb25eb62fdda1f3425d48b12372366e03 (diff)
wifi: mac80211: fix NULL pointer deref with non-MLD STA
If we have a non-MLD STA on an AP MLD, we crash while adding the station. Fix that, in this case we need to use the STA's address also on the link data structure. Fixes: f36fe0a2df03 ("wifi: mac80211: fix up link station creation/insertion") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index fe6500b36953..b0fdfc61b2f9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1854,10 +1854,15 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
!sdata->u.mgd.associated)
return -EINVAL;
+ /*
+ * If we have a link ID, it can be a non-MLO station on an AP MLD,
+ * but we need to have a link_mac in that case as well, so use the
+ * STA's MAC address in that case.
+ */
if (params->link_sta_params.link_id >= 0)
sta = sta_info_alloc_with_link(sdata, mac,
params->link_sta_params.link_id,
- params->link_sta_params.link_mac,
+ params->link_sta_params.link_mac ?: mac,
GFP_KERNEL);
else
sta = sta_info_alloc(sdata, mac, GFP_KERNEL);