aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2015-03-01 11:24:57 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2015-03-12 03:57:39 -0400
commit4557eaba13c2b9074c64e37bb93f77c4917a81b1 (patch)
tree9ebe46936756a71808543a02a0af972d493b5d09 /drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
parentfcf23352e0ff500676ac4923c68c20a1fe55fb5e (diff)
iwlwifi: don't allow the FW to return invalid ch indices
If the FW returns an invalid channels count in response to an MCC request, make sure we don't reference invalid indices in the channels array. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-nvm-parse.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index b372105604a0..774637746427 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -743,10 +743,15 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
743 int center_freq, prev_center_freq = 0; 743 int center_freq, prev_center_freq = 0;
744 int valid_rules = 0; 744 int valid_rules = 0;
745 bool new_rule; 745 bool new_rule;
746 int max_num_ch = cfg->device_family == IWL_DEVICE_FAMILY_8000 ?
747 IWL_NUM_CHANNELS_FAMILY_8000 : IWL_NUM_CHANNELS;
746 748
747 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES)) 749 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
748 return ERR_PTR(-EINVAL); 750 return ERR_PTR(-EINVAL);
749 751
752 if (WARN_ON(num_of_ch > max_num_ch))
753 num_of_ch = max_num_ch;
754
750 IWL_DEBUG_DEV(dev, IWL_DL_LAR, "building regdom for %d channels\n", 755 IWL_DEBUG_DEV(dev, IWL_DL_LAR, "building regdom for %d channels\n",
751 num_of_ch); 756 num_of_ch);
752 757