Commit 12d20fc9 authored by Purushottam Kushwaha's avatar Purushottam Kushwaha Committed by Johannes Berg

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.
Signed-off-by: default avatarPurushottam Kushwaha <pkushwah@qti.qualcomm.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7f8ed01e
...@@ -7752,12 +7752,13 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) ...@@ -7752,12 +7752,13 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
ibss.beacon_interval = 100; ibss.beacon_interval = 100;
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { if (info->attrs[NL80211_ATTR_BEACON_INTERVAL])
ibss.beacon_interval = ibss.beacon_interval =
nla_get_u32(info->attrs[NL80211_ATTR_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, ibss.beacon_interval);
} if (err)
return err;
if (!rdev->ops->join_ibss) if (!rdev->ops->join_ibss)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -9231,9 +9232,10 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) ...@@ -9231,9 +9232,10 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
setup.beacon_interval = setup.beacon_interval =
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
if (setup.beacon_interval < 10 ||
setup.beacon_interval > 10000) err = cfg80211_validate_beacon_int(rdev, setup.beacon_interval);
return -EINVAL; if (err)
return err;
} }
if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) { if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) {
......
...@@ -1559,7 +1559,7 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, ...@@ -1559,7 +1559,7 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev; struct wireless_dev *wdev;
int res = 0; int res = 0;
if (!beacon_int) if (beacon_int < 10 || beacon_int > 10000)
return -EINVAL; return -EINVAL;
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment