cfg80211: identically validate beacon interval for AP/MESH/IBSS

Beacon interval interface combinations validation was missing
for MESH/IBSS join, add those.

Johannes: also move the beacon interval check disallowing really
tiny and really big intervals into the common function, which
adds it for AP mode.

CRs-Fixed: 1087922
Change-Id: I282300533dcd80f65c9ba366246d028a6130ffff
Signed-off-by: Purushottam Kushwaha <pkushwah@qti.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Git-commit: 12d20fc9186a742d40e824f575df5aa62be31d69
[liord@codeaurora.org: fix conflicts and trivial compile errors]
Signed-off-by: Lior David <liord@codeaurora.org>
This commit is contained in:
Purushottam Kushwaha 2016-08-11 15:14:02 +05:30 committed by Lior David
parent ed8559eaeb
commit 9a27bdb53f
2 changed files with 13 additions and 8 deletions

View file

@ -7770,12 +7770,14 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
ibss.beacon_interval = 100;
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL])
ibss.beacon_interval =
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
if (ibss.beacon_interval < 1 || ibss.beacon_interval > 10000)
return -EINVAL;
}
err = cfg80211_validate_beacon_int(rdev, NL80211_IFTYPE_ADHOC,
ibss.beacon_interval);
if (err)
return err;
if (!rdev->ops->join_ibss)
return -EOPNOTSUPP;
@ -9013,9 +9015,12 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
setup.beacon_interval =
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
if (setup.beacon_interval < 10 ||
setup.beacon_interval > 10000)
return -EINVAL;
err = cfg80211_validate_beacon_int(rdev,
NL80211_IFTYPE_MESH_POINT,
setup.beacon_interval);
if (err)
return err;
}
if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) {

View file

@ -1490,7 +1490,7 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
.beacon_int_gcd = beacon_int, /* GCD(n) = n */
};
if (!beacon_int)
if (beacon_int < 10 || beacon_int > 10000)
return -EINVAL;
params.iftype_num[iftype] = 1;