diff options
author | Johannes Berg <johannes.berg@intel.com> | 2022-07-18 23:01:19 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-07-22 14:28:11 +0200 |
commit | 956b96133763dcfdf1b78de0910631f610df2d7b (patch) | |
tree | 9a4079a5fb20388c2a07b9c79e6ce77a882cbb28 /net/mac80211/cfg.c | |
parent | 0ad49045f28474b3cbc1f27ec7a4238970734764 (diff) |
wifi: mac80211: more station handling sanity checks
Add more sanity checks to the API handling, we shouldn't
be able to create a station without links, nor should we
be able to add a link to a station that wasn't created as
an MLD with links in the first place.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index fa4379761e12..f519d9cf6e23 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -4649,6 +4649,9 @@ static int sta_add_link_station(struct ieee80211_local *local, if (!sta) return -ENOENT; + if (!sta->sta.valid_links) + return -EINVAL; + if (sta->sta.valid_links & BIT(params->link_id)) return -EALREADY; @@ -4724,6 +4727,10 @@ static int sta_del_link_station(struct ieee80211_sub_if_data *sdata, if (!(sta->sta.valid_links & BIT(params->link_id))) return -EINVAL; + /* must not create a STA without links */ + if (sta->sta.valid_links == BIT(params->link_id)) + return -EINVAL; + ieee80211_sta_remove_link(sta, params->link_id); return 0; |