From 31d139ec0a6dc7f2737eeab86aceca6b2324eb95 Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Thu, 21 May 2020 18:33:30 +0530 Subject: [PATCH] qcacld-3.0: Do not send VDEV_INSTALL_KEY to fw if SAP/P2PGO is restarting Issue: Host is sending VDEV_INSTALL_KEY command without validating vdev state. If there is channel change request, in function lim_change_channel on WLAN_VDEV_SM_EV_CSA_COMPLETE, WLAN_VDEV_SM_EV_RESTART_REQ i.e vdev restart request is triggred to fw and if there is any ongoing sta connection parallely, then it may send vdev install without validating vdev state. If firmware receives VDEV_INSTALL_KEY, it stops critical channel request. Firmware sends VDEV_START_RESPONSE/VDEV_RESTART_RESPONSE once it gets channel grant. If host sends VDEV_INSTALL_KEY to fw before it gets channel grant then fw stops channel request and does not send VDEV_RESTART_RESPONSE. Fix: Valdiate vdev state before sending VDEV_INSTALL_KEY command. In function wlan_hdd_add_key_sap validate the state of vdev and send command only if vdev is in between restarting state. Change-Id: I427ab9bfab499818290dc36b6b4b3a4974b7d3a2 CRs-Fixed: 2605369 --- core/hdd/src/wlan_hdd_cfg80211.c | 11 +++++++++++ core/mac/src/pe/lim/lim_process_assoc_req_frame.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index a9934b60b87b..9b6b622148bd 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -16208,6 +16208,17 @@ static int wlan_hdd_add_key_sap(struct hdd_adapter *adapter, vdev = hdd_objmgr_get_vdev(adapter); if (!vdev) return -EINVAL; + + /* Do not send install key when sap restart is in progress. If there is + * critical channel request handling going on, fw will stop that request + * and will not send restart resposne + */ + if (wlan_vdev_is_restart_progress(vdev) == QDF_STATUS_SUCCESS) { + hdd_err("vdev: %d restart in progress", wlan_vdev_get_id(vdev)); + hdd_objmgr_put_vdev(vdev); + return -EINVAL; + } + if (hostapd_state->bss_state == BSS_START) { errno = wlan_cfg80211_crypto_add_key(vdev, (pairwise ? diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 857f80fefc71..3d8b01da4621 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -2211,7 +2211,7 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_in return; } - if (wlan_vdev_is_up(vdev) != QDF_STATUS_SUCCESS) { + if (wlan_vdev_mlme_get_state(vdev) != WLAN_VDEV_S_UP) { pe_err("SAP is not up, drop ASSOC REQ on sessionid: %d", session->peSessionId);