Skip to content

Commit 12d20fc

Browse files
Purushottam Kushwahajmberg-intel
authored andcommitted
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: Purushottam Kushwaha <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 7f8ed01 commit 12d20fc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

net/wireless/nl80211.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7752,12 +7752,13 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
77527752

77537753
ibss.beacon_interval = 100;
77547754

7755-
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
7755+
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL])
77567756
ibss.beacon_interval =
77577757
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
7758-
if (ibss.beacon_interval < 1 || ibss.beacon_interval > 10000)
7759-
return -EINVAL;
7760-
}
7758+
7759+
err = cfg80211_validate_beacon_int(rdev, ibss.beacon_interval);
7760+
if (err)
7761+
return err;
77617762

77627763
if (!rdev->ops->join_ibss)
77637764
return -EOPNOTSUPP;
@@ -9231,9 +9232,10 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
92319232
if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) {
92329233
setup.beacon_interval =
92339234
nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
9234-
if (setup.beacon_interval < 10 ||
9235-
setup.beacon_interval > 10000)
9236-
return -EINVAL;
9235+
9236+
err = cfg80211_validate_beacon_int(rdev, setup.beacon_interval);
9237+
if (err)
9238+
return err;
92379239
}
92389240

92399241
if (info->attrs[NL80211_ATTR_DTIM_PERIOD]) {

net/wireless/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
15591559
struct wireless_dev *wdev;
15601560
int res = 0;
15611561

1562-
if (!beacon_int)
1562+
if (beacon_int < 10 || beacon_int > 10000)
15631563
return -EINVAL;
15641564

15651565
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {

0 commit comments

Comments
 (0)