From 0a569299e8ecab7621e92029fec869c0370ccfc6 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Wed, 14 Feb 2018 15:34:47 +0530 Subject: [PATCH] qcacld-3.0: Check for SME state in hdd_get_sta_connection_in_progress Currently in hdd_get_sta_connection_in_progress, conn_info.uIsAuthenticated is used to check if the STA connection is in progress. However, this might not reflect the actual state and might still lead to the deadlock scenario fixed in I23ad1fc96882abeaae2d1b051659ea6d24b07428. Add new API to check for SME state for key exchange in progress and use it in hdd_get_sta_connection_in_progress. Change-Id: I7d6199ed8c81a113c4e3f30538d74fb675e730ff CRs-Fixed: 2189814 --- core/hdd/src/wlan_hdd_assoc.c | 3 ++- core/hdd/src/wlan_hdd_main.c | 6 +++--- core/sme/inc/sme_api.h | 12 ++++++++++++ core/sme/src/common/sme_api.c | 12 ++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 00a51cdbc751..6be204233968 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -332,7 +332,8 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress( return adapter; } else if ((eConnectionState_Associated == hdd_sta_ctx->conn_info.connState) && - !hdd_sta_ctx->conn_info.uIsAuthenticated) { + sme_is_sta_key_exchange_in_progress( + hdd_ctx->hHal, adapter->session_id)) { hdd_debug("session_id %d: Key exchange is in progress", adapter->session_id); return adapter; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 2549ce303ec7..15feba8f9cc2 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -13095,9 +13095,9 @@ bool hdd_is_connection_in_progress(uint8_t *session_id, hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if ((eConnectionState_Associated == - hdd_sta_ctx->conn_info.connState) - && (false == - hdd_sta_ctx->conn_info.uIsAuthenticated)) { + hdd_sta_ctx->conn_info.connState) + && sme_is_sta_key_exchange_in_progress( + hdd_ctx->hHal, adapter->session_id)) { sta_mac = (uint8_t *) &(adapter->mac_addr.bytes[0]); hdd_debug("client " MAC_ADDRESS_STR diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 231a8896f774..350242b49d45 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -2168,4 +2168,16 @@ static inline int sme_update_he_rx_stbc_cap(tHalHandle hal, uint8_t session_id, } #endif +/** + * sme_is_sta_key_exchange_in_progress() - checks whether the STA/P2P client + * session has key exchange in progress + * + * @hal: global hal handle + * @session_id: session id + * + * Return: true - if key exchange in progress + * false - if not in progress + */ +bool sme_is_sta_key_exchange_in_progress(tHalHandle hal, uint8_t session_id); + #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 20b08b7d1aaa..ce05979c539f 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16237,3 +16237,15 @@ QDF_STATUS sme_handle_sae_msg(tHalHandle hal, uint8_t session_id, return qdf_status; } #endif + +bool sme_is_sta_key_exchange_in_progress(tHalHandle hal, uint8_t session_id) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + + if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) { + sme_err("Invalid session id: %d", session_id); + return false; + } + + return CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id); +}