aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2018-08-22 07:52:21 -0400
committerJohannes Berg <johannes.berg@intel.com>2018-08-28 05:11:47 -0400
commit38cb87ee47fb825f6c9d645c019f75b3905c0ab2 (patch)
treeadeb37dce51986c11e2a6667aab5ee09bcaff6ff /net/mac80211/util.c
parentd7c863a2f65e48f442379f4ee1846d52e0c5d24d (diff)
cfg80211: make wmm_rule part of the reg_rule structure
Make wmm_rule be part of the reg_rule structure. This simplifies the code a lot at the cost of having bigger memory usage. However in most cases we have only few reg_rule's and when we do have many like in iwlwifi we do not save memory as it allocates a separate wmm_rule for each channel anyway. This also fixes a bug reported in various places where somewhere the pointers were corrupted and we ended up doing a null-dereference. Fixes: 230ebaa189af ("cfg80211: read wmm rules from regulatory database") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> [rephrase commit message slightly] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index d02fbfec3783..c80187d6e6bb 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1120,7 +1120,7 @@ void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
1120{ 1120{
1121 struct ieee80211_chanctx_conf *chanctx_conf; 1121 struct ieee80211_chanctx_conf *chanctx_conf;
1122 const struct ieee80211_reg_rule *rrule; 1122 const struct ieee80211_reg_rule *rrule;
1123 struct ieee80211_wmm_ac *wmm_ac; 1123 const struct ieee80211_wmm_ac *wmm_ac;
1124 u16 center_freq = 0; 1124 u16 center_freq = 0;
1125 1125
1126 if (sdata->vif.type != NL80211_IFTYPE_AP && 1126 if (sdata->vif.type != NL80211_IFTYPE_AP &&
@@ -1139,15 +1139,15 @@ void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
1139 1139
1140 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq)); 1140 rrule = freq_reg_info(sdata->wdev.wiphy, MHZ_TO_KHZ(center_freq));
1141 1141
1142 if (IS_ERR_OR_NULL(rrule) || !rrule->wmm_rule) { 1142 if (IS_ERR_OR_NULL(rrule) || !rrule->has_wmm) {
1143 rcu_read_unlock(); 1143 rcu_read_unlock();
1144 return; 1144 return;
1145 } 1145 }
1146 1146
1147 if (sdata->vif.type == NL80211_IFTYPE_AP) 1147 if (sdata->vif.type == NL80211_IFTYPE_AP)
1148 wmm_ac = &rrule->wmm_rule->ap[ac]; 1148 wmm_ac = &rrule->wmm_rule.ap[ac];
1149 else 1149 else
1150 wmm_ac = &rrule->wmm_rule->client[ac]; 1150 wmm_ac = &rrule->wmm_rule.client[ac];
1151 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min); 1151 qparam->cw_min = max_t(u16, qparam->cw_min, wmm_ac->cw_min);
1152 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max); 1152 qparam->cw_max = max_t(u16, qparam->cw_max, wmm_ac->cw_max);
1153 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn); 1153 qparam->aifs = max_t(u8, qparam->aifs, wmm_ac->aifsn);