summaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-10-08 14:37:47 +0200
committerJohannes Berg <johannes.berg@intel.com>2014-10-22 10:42:09 +0200
commitf409079bb678600be0201cd03afb4731f0480b4e (patch)
tree4e2d6d4fe2a20aa048067af57b0bd49cf145e25c /net/mac80211
parentcfg80211: make WMM TSPEC support flag an nl80211 feature flag (diff)
downloadlinux-f409079bb678600be0201cd03afb4731f0480b4e.tar.xz
linux-f409079bb678600be0201cd03afb4731f0480b4e.zip
mac80211: sanity check CW_min/CW_max towards driver
There's no reason to ever set invalid CW_min/CW_max to the drivers, we should catch it in higher layers. However, the consequences of setting it wrong can be quite severe, so double-check at a low level and error out for invalid data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/driver-ops.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 1bbb0790264f..3df28e0fa045 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -631,6 +631,12 @@ static inline int drv_conf_tx(struct ieee80211_local *local,
if (!check_sdata_in_driver(sdata))
return -EIO;
+ if (WARN_ONCE(params->cw_min == 0 ||
+ params->cw_min > params->cw_max,
+ "%s: invalid CW_min/CW_max: %d/%d\n",
+ sdata->name, params->cw_min, params->cw_max))
+ return -EINVAL;
+
trace_drv_conf_tx(local, sdata, ac, params);
if (local->ops->conf_tx)
ret = local->ops->conf_tx(&local->hw, &sdata->vif,