]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
wifi: cfg80211: validate AP phy operation before starting it
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 5 Sep 2023 06:48:57 +0000 (12:18 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 10:18:55 +0000 (12:18 +0200)
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 <quic_adisi@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230905064857.1503-1-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index de47838aca4f25af9fc6872225004441ca809cc1..0c989a839e561a25b1e5f52891ba7c76370d5ba1 100644 (file)
@@ -5909,6 +5909,21 @@ out:
        nlmsg_free(msg);
 }
 
+static int nl80211_validate_ap_phy_operation(struct cfg80211_ap_settings *params)
+{
+       struct ieee80211_channel *channel = params->chandef.chan;
+
+       if ((params->he_cap ||  params->he_oper) &&
+           (channel->flags & IEEE80211_CHAN_NO_HE))
+               return -EOPNOTSUPP;
+
+       if ((params->eht_cap || params->eht_oper) &&
+           (channel->flags & IEEE80211_CHAN_NO_EHT))
+               return -EOPNOTSUPP;
+
+       return 0;
+}
+
 static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 {
        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)
        if (err)
                goto out_unlock;
 
+       err = nl80211_validate_ap_phy_operation(params);
+       if (err)
+               goto out_unlock;
+
        if (info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS])
                params->flags = nla_get_u32(
                        info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]);