Commit 9dc216d7 authored by Johannes Berg's avatar Johannes Berg

iwlwifi: trust mac80211 channel setting

mac80211 will never set, switch to, or scan on an
invalid channel, so remove the code to validate
the channels against the driver channel list.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7ad580c2
...@@ -1182,7 +1182,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1182,7 +1182,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
struct iwl_rxon_context *ctx; struct iwl_rxon_context *ctx;
struct ieee80211_conf *conf = &hw->conf; struct ieee80211_conf *conf = &hw->conf;
struct ieee80211_channel *channel = conf->channel; struct ieee80211_channel *channel = conf->channel;
const struct iwl_channel_info *ch_info;
int ret = 0; int ret = 0;
IWL_DEBUG_MAC80211(priv, "enter: changed %#x\n", changed); IWL_DEBUG_MAC80211(priv, "enter: changed %#x\n", changed);
...@@ -1216,14 +1215,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1216,14 +1215,6 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
ch_info = iwl_get_channel_info(priv, channel->band,
channel->hw_value);
if (!is_channel_valid(ch_info)) {
IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
ret = -EINVAL;
goto out;
}
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
/* Configure HT40 channels */ /* Configure HT40 channels */
if (ctx->ht.enabled != conf_is_ht(conf)) if (ctx->ht.enabled != conf_is_ht(conf))
......
...@@ -844,7 +844,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -844,7 +844,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
struct ieee80211_channel_switch *ch_switch) struct ieee80211_channel_switch *ch_switch)
{ {
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
const struct iwl_channel_info *ch_info;
struct ieee80211_conf *conf = &hw->conf; struct ieee80211_conf *conf = &hw->conf;
struct ieee80211_channel *channel = ch_switch->channel; struct ieee80211_channel *channel = ch_switch->channel;
struct iwl_ht_config *ht_conf = &priv->current_ht_config; struct iwl_ht_config *ht_conf = &priv->current_ht_config;
...@@ -881,12 +880,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -881,12 +880,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
if (le16_to_cpu(ctx->active.channel) == ch) if (le16_to_cpu(ctx->active.channel) == ch)
goto out; goto out;
ch_info = iwl_get_channel_info(priv, channel->band, ch);
if (!is_channel_valid(ch_info)) {
IWL_DEBUG_MAC80211(priv, "invalid channel\n");
goto out;
}
priv->current_ht_config.smps = conf->smps_mode; priv->current_ht_config.smps = conf->smps_mode;
/* Configure HT40 channels */ /* Configure HT40 channels */
......
...@@ -534,7 +534,6 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -534,7 +534,6 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
{ {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
const struct ieee80211_supported_band *sband; const struct ieee80211_supported_band *sband;
const struct iwl_channel_info *ch_info;
u16 passive_dwell = 0; u16 passive_dwell = 0;
u16 active_dwell = 0; u16 active_dwell = 0;
int added, i; int added, i;
...@@ -559,16 +558,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -559,16 +558,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
channel = chan->hw_value; channel = chan->hw_value;
scan_ch->channel = cpu_to_le16(channel); scan_ch->channel = cpu_to_le16(channel);
ch_info = iwl_get_channel_info(priv, band, channel); if (!is_active || (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
if (!is_channel_valid(ch_info)) {
IWL_DEBUG_SCAN(priv,
"Channel %d is INVALID for this band.\n",
channel);
continue;
}
if (!is_active || is_channel_passive(ch_info) ||
(chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
else else
scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
......
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