summaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2022-07-18 22:23:53 +0200
committerJohannes Berg <johannes.berg@intel.com>2022-07-22 14:28:08 +0200
commit9aebce6c97bfd7dafd364be2e5b3af7a78af2662 (patch)
tree9fb608d5d03f9f6dfd02bc085bda95f485a1cd41 /net/mac80211
parent6d8e0f84f89f99c87608569e374d52cf248978ee (diff)
downloadlinux-9aebce6c97bfd7dafd364be2e5b3af7a78af2662.tar.bz2
wifi: mac80211: validate link address doesn't change
When modifying a link station, validate that the link address doesn't change, except the first time the link is created. Fixes: b95eb7f0eee4 ("wifi: cfg80211/mac80211: separate link params from station params") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b0fdfc61b2f9..fa4379761e12 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1597,7 +1597,7 @@ static void sta_apply_mesh_params(struct ieee80211_local *local,
}
static int sta_link_apply_parameters(struct ieee80211_local *local,
- struct sta_info *sta,
+ struct sta_info *sta, bool new_link,
struct link_station_parameters *params)
{
int ret = 0;
@@ -1618,8 +1618,13 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
return -EINVAL;
if (params->link_mac) {
- memcpy(link_sta->addr, params->link_mac, ETH_ALEN);
- memcpy(link_sta->pub->addr, params->link_mac, ETH_ALEN);
+ if (new_link) {
+ memcpy(link_sta->addr, params->link_mac, ETH_ALEN);
+ memcpy(link_sta->pub->addr, params->link_mac, ETH_ALEN);
+ } else if (!ether_addr_equal(link_sta->addr,
+ params->link_mac)) {
+ return -EINVAL;
+ }
}
if (params->txpwr_set) {
@@ -1797,7 +1802,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,
if (params->listen_interval >= 0)
sta->listen_interval = params->listen_interval;
- ret = sta_link_apply_parameters(local, sta, &params->link_sta_params);
+ ret = sta_link_apply_parameters(local, sta, false,
+ &params->link_sta_params);
if (ret)
return ret;
@@ -4650,7 +4656,7 @@ static int sta_add_link_station(struct ieee80211_local *local,
if (ret)
return ret;
- ret = sta_link_apply_parameters(local, sta, params);
+ ret = sta_link_apply_parameters(local, sta, true, params);
if (ret) {
ieee80211_sta_free_link(sta, params->link_id);
return ret;
@@ -4688,7 +4694,7 @@ static int sta_mod_link_station(struct ieee80211_local *local,
if (!(sta->sta.valid_links & BIT(params->link_id)))
return -EINVAL;
- return sta_link_apply_parameters(local, sta, params);
+ return sta_link_apply_parameters(local, sta, false, params);
}
static int