Commit ba23d206 authored by Johannes Berg's avatar Johannes Berg

cfg80211: disallow more station changes

The following changes are invalid and should be
disallowed when a station already exists:
 * supported rates changes, except for TDLS peers
 * listen interval changes
 * HT capability changes

Disallow them and also update a mac80211 comment
explaining how they would be racy.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 21add825
...@@ -1208,10 +1208,11 @@ static int sta_apply_parameters(struct ieee80211_local *local, ...@@ -1208,10 +1208,11 @@ static int sta_apply_parameters(struct ieee80211_local *local,
sta->sta.aid = params->aid; sta->sta.aid = params->aid;
/* /*
* FIXME: updating the following information is racy when this * Some of the following updates would be racy if called on an
* function is called from ieee80211_change_station(). * existing station, via ieee80211_change_station(). However,
* However, all this information should be static so * all such changes are rejected by cfg80211 except for updates
* maybe we should just reject attemps to change it. * changing the supported rates on an existing but not yet used
* TDLS peer.
*/ */
if (params->listen_interval >= 0) if (params->listen_interval >= 0)
......
...@@ -3188,13 +3188,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) ...@@ -3188,13 +3188,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
} }
if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL] ||
params.listen_interval = info->attrs[NL80211_ATTR_HT_CAPABILITY])
nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); return -EINVAL;
if (info->attrs[NL80211_ATTR_HT_CAPABILITY])
params.ht_capa =
nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
if (!rdev->ops->change_station) if (!rdev->ops->change_station)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -3246,6 +3242,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) ...@@ -3246,6 +3242,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
BIT(NL80211_STA_FLAG_ASSOCIATED))) BIT(NL80211_STA_FLAG_ASSOCIATED)))
return -EINVAL; return -EINVAL;
/* reject other things that can't change */
if (params.supported_rates)
return -EINVAL;
/* must be last in here for error handling */ /* must be last in here for error handling */
params.vlan = get_vlan(info, rdev); params.vlan = get_vlan(info, rdev);
if (IS_ERR(params.vlan)) if (IS_ERR(params.vlan))
...@@ -3265,10 +3265,6 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) ...@@ -3265,10 +3265,6 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
/* disallow things sta doesn't support */ /* disallow things sta doesn't support */
if (params.plink_action) if (params.plink_action)
return -EINVAL; return -EINVAL;
if (params.ht_capa)
return -EINVAL;
if (params.listen_interval >= 0)
return -EINVAL;
/* reject any changes other than AUTHORIZED */ /* reject any changes other than AUTHORIZED */
if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED)) if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED))
return -EINVAL; return -EINVAL;
...@@ -3277,9 +3273,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) ...@@ -3277,9 +3273,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
/* disallow things mesh doesn't support */ /* disallow things mesh doesn't support */
if (params.vlan) if (params.vlan)
return -EINVAL; return -EINVAL;
if (params.ht_capa) if (params.supported_rates)
return -EINVAL;
if (params.listen_interval >= 0)
return -EINVAL; return -EINVAL;
/* /*
* No special handling for TDLS here -- the userspace * No special handling for TDLS here -- the userspace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment