[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <ce42107117526535474cf81d514fd030c7376e85.1752225123.git.repk@triplefau.lt>
Date: Fri, 11 Jul 2025 12:03:20 +0200
From: Remi Pommarel <repk@...plefau.lt>
To: linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Johannes Berg <johannes@...solutions.net>,
Remi Pommarel <repk@...plefau.lt>
Subject: [RFC PATCH v2 wireless-next 3/3] wifi: mac80211: Check link id at
station removal
hostapd can remove a non-MLD sta connected to one link of one MLD AP
several times. If the sta roamed to another link of the same MLD AP
between two of those removals the wrong sta_info could be removed.
To fix that remove sta only if it is currently using the link specified
in NL80211_CMD_DEL_STATION if they are any.
Signed-off-by: Remi Pommarel <repk@...plefau.lt>
---
net/mac80211/cfg.c | 3 ++-
net/mac80211/sta_info.c | 7 ++++++-
net/mac80211/sta_info.h | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 56540c3701ed..727eea74bd37 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2217,7 +2217,8 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (params->mac)
- return sta_info_destroy_addr_bss(sdata, params->mac);
+ return sta_info_destroy_addr_bss(sdata, params->mac,
+ params->link_id);
sta_info_flush(sdata, params->link_id);
return 0;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 8c550aab9bdc..f43ebc97134f 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1579,13 +1579,18 @@ int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, const u8 *addr)
}
int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata,
- const u8 *addr)
+ const u8 *addr, int link_id)
{
struct sta_info *sta;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
sta = sta_info_get_bss(sdata, addr);
+
+ if (sta && link_id >= 0 && sta->sta.valid_links &&
+ !(sta->sta.valid_links & BIT(link_id)))
+ return -EINVAL;
+
return __sta_info_destroy(sta);
}
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 5288d5286651..a6d2c847a91c 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -932,7 +932,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta);
int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata,
const u8 *addr);
int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata,
- const u8 *addr);
+ const u8 *addr, int link_id);
void sta_info_recalc_tim(struct sta_info *sta);
--
2.40.0
Powered by blists - more mailing lists