summaryrefslogtreecommitdiffstats
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
parent723e73acd16d2ea08cdbd8b449b7bc69389b94d4 (diff)
downloadop-kernel-dev-f409079bb678600be0201cd03afb4731f0480b4e.zip
op-kernel-dev-f409079bb678600be0201cd03afb4731f0480b4e.tar.gz
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>
-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 1bbb079..3df28e0 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,
OpenPOWER on IntegriCloud