Skip to content

Commit 5112fa5

Browse files
Aditya Kumar Singhjmberg-intel
authored andcommitted
wifi: cfg80211: validate AP phy operation before starting it
Many regulatories can have HE/EHT Operation as not permitted. In such cases, AP should not be allowed to start if it is using a channel having the no operation flag set. However, currently there is no such check in place. Fix this issue by validating such IEs sent during start AP against the channel flags. Signed-off-by: Aditya Kumar Singh <[email protected]> Reviewed-by: Jeff Johnson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 234249d commit 5112fa5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

net/wireless/nl80211.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5909,6 +5909,21 @@ static void nl80211_send_ap_started(struct wireless_dev *wdev,
59095909
nlmsg_free(msg);
59105910
}
59115911

5912+
static int nl80211_validate_ap_phy_operation(struct cfg80211_ap_settings *params)
5913+
{
5914+
struct ieee80211_channel *channel = params->chandef.chan;
5915+
5916+
if ((params->he_cap || params->he_oper) &&
5917+
(channel->flags & IEEE80211_CHAN_NO_HE))
5918+
return -EOPNOTSUPP;
5919+
5920+
if ((params->eht_cap || params->eht_oper) &&
5921+
(channel->flags & IEEE80211_CHAN_NO_EHT))
5922+
return -EOPNOTSUPP;
5923+
5924+
return 0;
5925+
}
5926+
59125927
static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
59135928
{
59145929
struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -6178,6 +6193,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
61786193
if (err)
61796194
goto out_unlock;
61806195

6196+
err = nl80211_validate_ap_phy_operation(params);
6197+
if (err)
6198+
goto out_unlock;
6199+
61816200
if (info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS])
61826201
params->flags = nla_get_u32(
61836202
info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]);

0 commit comments

Comments
 (0)