From b74448cea13dc40fc7d8da37d0b255cf11ec6663 Mon Sep 17 00:00:00 2001 From: Sai Pavan Akhil Remella Date: Wed, 15 Mar 2023 15:04:28 +0530 Subject: [PATCH] qcacld-3.0: Add keymgmt check for 6 GHz in CSA path Currently in CSA path if the target channel is 6 GHz, it is not checking the keymgmt used and allowing the open security to be configured. This changes add check for open security for 6 GHz if check_6ghz_security ini is enabled. Change-Id: Ie26ff05dc7c7a97a48398c2a81b091f66c6bd39e CRs-Fixed: 3413618 --- core/hdd/src/wlan_hdd_hostapd.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 6f90efbdd0..5a70ef339a 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3242,6 +3242,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, QDF_STATUS status; int ret = 0; struct hdd_adapter *adapter = (netdev_priv(dev)); + struct hdd_beacon_data *beacon = adapter->deflink->session.ap.beacon; struct hdd_context *hdd_ctx = NULL; struct hdd_adapter *sta_adapter; struct hdd_station_ctx *sta_ctx; @@ -3253,6 +3254,10 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, bool strict; uint32_t sta_cnt = 0; struct ch_params ch_params = {0}; + const u8 *rsn_ie, *rsnxe_ie; + struct wlan_crypto_params crypto_params = {0}; + bool capable, is_wps; + int32_t keymgmt; hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); @@ -3282,6 +3287,32 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, return ret; } + if (WLAN_REG_IS_6GHZ_CHAN_FREQ(target_chan_freq)) { + rsn_ie = wlan_get_ie_ptr_from_eid(WLAN_EID_RSN, + beacon->tail, + beacon->tail_len); + rsnxe_ie = wlan_get_ie_ptr_from_eid(WLAN_ELEMID_RSNXE, + beacon->tail, + beacon->tail_len); + if (rsn_ie) + wlan_crypto_rsnie_check(&crypto_params, rsn_ie); + + keymgmt = wlan_crypto_get_param(sap_ctx->vdev, + WLAN_CRYPTO_PARAM_KEY_MGMT); + if (keymgmt < 0) { + hdd_err_rl("Invalid keymgmt"); + return -EINVAL; + } + + is_wps = adapter->device_mode == QDF_P2P_GO_MODE ? true : false; + capable = wlan_cm_6ghz_allowed_for_akm(hdd_ctx->psoc, keymgmt, + crypto_params.rsn_caps, + rsnxe_ie, 0, is_wps); + if (!capable) { + hdd_err_rl("6Ghz channel switch not capable"); + return -EINVAL; + } + } sta_adapter = hdd_get_adapter(hdd_ctx, QDF_STA_MODE); ucfg_policy_mgr_get_conc_rule1(hdd_ctx->psoc, &conc_rule1); /*