Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6
+6
net/mac80211/driver-ops.h
··· 631 631 if (!check_sdata_in_driver(sdata)) 632 632 return -EIO; 633 633 634 + if (WARN_ONCE(params->cw_min == 0 || 635 + params->cw_min > params->cw_max, 636 + "%s: invalid CW_min/CW_max: %d/%d\n", 637 + sdata->name, params->cw_min, params->cw_max)) 638 + return -EINVAL; 639 + 634 640 trace_drv_conf_tx(local, sdata, ac, params); 635 641 if (local->ops->conf_tx) 636 642 ret = local->ops->conf_tx(&local->hw, &sdata->vif,