qcacld-3.0: Remove unused tdls structures in pe
It alloc memory with structures in sir_api.h, and process/parse them
with structures in tdls component, which will cause memory corruption
potentially. So, this change refacor these functions and let them use
unified structures. Remove unused structures in sir_api.h
Here are these functions:
- lim_send_sme_tdls_add_sta_rsp
- lim_send_tdls_comp_mgmt_rsp
- lim_send_sme_tdls_del_sta_rsp
- lim_send_sme_mgmt_tx_completion
Remove below unused tdls structures:
- tSirTdlsDelAllPeerInd
- tSirTdlsDelStaInd
- tSirTdlsEventnotify
- tSirTdlsLinkEstablishReq
- tSirTdlsLinkEstablishReqRsp
- tSirTdlsAddStaRsp
- tSirTdlsDelStaRsp
- tSirMgmtTxCompletionInd
Change-Id: Ic595cadefcdbeb2df44f97563c4652db409213a2
CRs-Fixed: 2373706
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 172f2d3..3d90f69 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -2597,50 +2597,6 @@
uint8_t max_sp;
} tSirTdlsAddStaReq, *tpSirSmeTdlsAddStaReq;
-/* TDLS Response struct PE-->SME */
-typedef struct sSirTdlsAddStaRsp {
- uint16_t messageType;
- uint16_t length;
- tSirResultCodes statusCode;
- struct qdf_mac_addr peermac;
- uint8_t sessionId; /* Session ID */
- uint16_t staId;
- uint16_t staType;
- enum tdls_add_oper tdlsAddOper;
- struct wlan_objmgr_psoc *psoc;
-} tSirTdlsAddStaRsp;
-
-/* TDLS Request struct SME-->PE */
-typedef struct {
- uint16_t messageType; /* eWNI_SME_TDLS_LINK_ESTABLISH_REQ */
- uint16_t length;
- uint8_t sessionId; /* Session ID */
- uint16_t transactionId; /* Transaction ID for cmd */
- uint8_t uapsdQueues; /* Peer's uapsd Queues Information */
- uint8_t maxSp; /* Peer's Supported Maximum Service Period */
- uint8_t isBufSta; /* Does Peer Support as Buffer Station. */
- /* Does Peer Support as TDLS Off Channel. */
- uint8_t isOffChannelSupported;
- uint8_t isResponder; /* Is Peer a responder. */
- /* For multi-session, for PE to locate peSession ID */
- struct qdf_mac_addr bssid;
- struct qdf_mac_addr peermac;
- uint8_t supportedChannelsLen;
- uint8_t supportedChannels[SIR_MAC_MAX_SUPP_CHANNELS];
- uint8_t supportedOperClassesLen;
- uint8_t supportedOperClasses[REG_MAX_SUPP_OPER_CLASSES];
-} tSirTdlsLinkEstablishReq, *tpSirTdlsLinkEstablishReq;
-
-/* TDLS Request struct SME-->PE */
-typedef struct {
- uint16_t messageType; /* eWNI_SME_TDLS_LINK_ESTABLISH_RSP */
- uint16_t length;
- uint8_t sessionId; /* Session ID */
- uint16_t transactionId; /* Transaction ID for cmd */
- tSirResultCodes statusCode;
- struct qdf_mac_addr peermac;
-} tSirTdlsLinkEstablishReqRsp, *tpSirTdlsLinkEstablishReqRsp;
-
/* TDLS Request struct SME-->PE */
typedef struct sSirTdlsDelStaReq {
uint16_t messageType; /* eWNI_SME_TDLS_DISCOVERY_START_REQ */
@@ -2651,44 +2607,6 @@
struct qdf_mac_addr bssid;
struct qdf_mac_addr peermac;
} tSirTdlsDelStaReq, *tpSirSmeTdlsDelStaReq;
-/* TDLS Response struct PE-->SME */
-typedef struct sSirTdlsDelStaRsp {
- uint16_t messageType;
- uint16_t length;
- uint8_t sessionId; /* Session ID */
- tSirResultCodes statusCode;
- struct qdf_mac_addr peermac;
- uint16_t staId;
- struct wlan_objmgr_psoc *psoc;
-} tSirTdlsDelStaRsp, *tpSirTdlsDelStaRsp;
-/* TDLS Delete Indication struct PE-->SME */
-typedef struct sSirTdlsDelStaInd {
- uint16_t messageType;
- uint16_t length;
- uint8_t sessionId; /* Session ID */
- struct qdf_mac_addr peermac;
- uint16_t staId;
- uint16_t reasonCode;
-} tSirTdlsDelStaInd, *tpSirTdlsDelStaInd;
-typedef struct sSirTdlsDelAllPeerInd {
- uint16_t messageType;
- uint16_t length;
- uint8_t sessionId; /* Session ID */
-} tSirTdlsDelAllPeerInd, *tpSirTdlsDelAllPeerInd;
-typedef struct sSirMgmtTxCompletionInd {
- uint16_t messageType;
- uint16_t length;
- uint8_t sessionId; /* Session ID */
- uint32_t txCompleteStatus;
- struct wlan_objmgr_psoc *psoc;
-} tSirMgmtTxCompletionInd, *tpSirMgmtTxCompletionInd;
-
-typedef struct sSirTdlsEventnotify {
- uint8_t sessionId;
- struct qdf_mac_addr peermac;
- uint16_t messageType;
- uint32_t peer_reason;
-} tSirTdlsEventnotify;
#endif /* FEATURE_WLAN_TDLS */
/* Reset AP Caps Changed */
diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c
index 93aafb0..8a2d4d6 100644
--- a/core/mac/src/pe/lim/lim_process_tdls.c
+++ b/core/mac/src/pe/lim/lim_process_tdls.c
@@ -73,6 +73,7 @@
#include "wlan_tdls_tgt_api.h"
#include "wlan_mlme_public_struct.h"
#include "wlan_mlme_api.h"
+#include "wlan_tdls_public_structs.h"
/* define NO_PAD_TDLS_MIN_8023_SIZE to NOT padding: See CR#447630
There was IOT issue with cisco 1252 open mode, where it pads
@@ -2677,38 +2678,43 @@
uint8_t updateSta,
tDphHashNode *pStaDs, uint8_t status)
{
- struct scheduler_msg mmhMsg = { 0 };
- tSirTdlsAddStaRsp *addStaRsp = NULL;
+ struct scheduler_msg msg = { 0 };
+ struct tdls_add_sta_rsp *add_sta_rsp;
+ QDF_STATUS ret;
- mmhMsg.type = eWNI_SME_TDLS_ADD_STA_RSP;
+ msg.type = eWNI_SME_TDLS_ADD_STA_RSP;
- addStaRsp = qdf_mem_malloc(sizeof(tSirTdlsAddStaRsp));
- if (!addStaRsp)
+ add_sta_rsp = qdf_mem_malloc(sizeof(*add_sta_rsp));
+ if (!add_sta_rsp)
return QDF_STATUS_E_NOMEM;
- addStaRsp->sessionId = sessionId;
- addStaRsp->statusCode = status;
+ add_sta_rsp->session_id = sessionId;
+ add_sta_rsp->status_code = status;
if (pStaDs) {
- addStaRsp->staId = pStaDs->staIndex;
+ add_sta_rsp->sta_id = pStaDs->staIndex;
}
if (peerMac) {
- qdf_mem_copy(addStaRsp->peermac.bytes,
+ qdf_mem_copy(add_sta_rsp->peermac.bytes,
(uint8_t *) peerMac, QDF_MAC_ADDR_SIZE);
}
if (updateSta)
- addStaRsp->tdlsAddOper = TDLS_OPER_UPDATE;
+ add_sta_rsp->tdls_oper = TDLS_OPER_UPDATE;
else
- addStaRsp->tdlsAddOper = TDLS_OPER_ADD;
+ add_sta_rsp->tdls_oper = TDLS_OPER_ADD;
- addStaRsp->length = sizeof(tSirTdlsAddStaRsp);
- addStaRsp->messageType = eWNI_SME_TDLS_ADD_STA_RSP;
- addStaRsp->psoc = mac->psoc;
- mmhMsg.bodyptr = addStaRsp;
- mmhMsg.callback = tgt_tdls_add_peer_rsp;
+ add_sta_rsp->psoc = mac->psoc;
+ msg.bodyptr = add_sta_rsp;
+ msg.callback = tgt_tdls_add_peer_rsp;
- return scheduler_post_message(QDF_MODULE_ID_PE,
- QDF_MODULE_ID_TDLS,
- QDF_MODULE_ID_TARGET_IF, &mmhMsg);
+ ret = scheduler_post_message(QDF_MODULE_ID_PE,
+ QDF_MODULE_ID_TDLS,
+ QDF_MODULE_ID_TARGET_IF, &msg);
+ if (QDF_IS_STATUS_ERROR(ret)) {
+ pe_err("post msg fail, %d", ret);
+ qdf_mem_free(add_sta_rsp);
+ }
+
+ return ret;
}
/*
@@ -2776,30 +2782,32 @@
uint16_t sme_transaction_id)
{
struct scheduler_msg msg = {0};
- tSirSmeRsp *sme_rsp;
+ struct tdls_send_mgmt_rsp *sme_rsp;
+ QDF_STATUS status;
pe_debug("Sending message %s with reasonCode %s",
lim_msg_str(msg_type), lim_result_code_str(result_code));
- sme_rsp = qdf_mem_malloc(sizeof(tSirSmeRsp));
+ sme_rsp = qdf_mem_malloc(sizeof(*sme_rsp));
if (!sme_rsp)
return;
- sme_rsp->messageType = msg_type;
- sme_rsp->length = sizeof(tSirSmeRsp);
- sme_rsp->statusCode = result_code;
+ sme_rsp->status_code = (enum legacy_result_code)result_code;
- sme_rsp->sessionId = sme_session_id;
- sme_rsp->transactionId = sme_transaction_id;
+ sme_rsp->session_id = sme_session_id;
+ sme_rsp->transaction_id = sme_transaction_id;
msg.type = msg_type;
sme_rsp->psoc = mac_ctx->psoc;
msg.bodyptr = sme_rsp;
msg.callback = tgt_tdls_send_mgmt_rsp;
- scheduler_post_message(QDF_MODULE_ID_PE,
- QDF_MODULE_ID_TDLS,
- QDF_MODULE_ID_TARGET_IF, &msg);
-
+ status = scheduler_post_message(QDF_MODULE_ID_PE,
+ QDF_MODULE_ID_TDLS,
+ QDF_MODULE_ID_TARGET_IF, &msg);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pe_err("post msg fail, %d", status);
+ qdf_mem_free(sme_rsp);
+ }
}
/**
@@ -2942,32 +2950,37 @@
struct qdf_mac_addr peerMac,
tDphHashNode *pStaDs, uint8_t status)
{
- struct scheduler_msg mmhMsg = { 0 };
- tSirTdlsDelStaRsp *pDelSta = NULL;
+ struct scheduler_msg msg = { 0 };
+ struct tdls_del_sta_rsp *del_sta_rsp;
+ QDF_STATUS ret;
- mmhMsg.type = eWNI_SME_TDLS_DEL_STA_RSP;
+ msg.type = eWNI_SME_TDLS_DEL_STA_RSP;
- pDelSta = qdf_mem_malloc(sizeof(tSirTdlsDelStaRsp));
- if (!pDelSta)
+ del_sta_rsp = qdf_mem_malloc(sizeof(*del_sta_rsp));
+ if (!del_sta_rsp)
return QDF_STATUS_E_NOMEM;
- pDelSta->sessionId = sessionId;
- pDelSta->statusCode = status;
+ del_sta_rsp->session_id = sessionId;
+ del_sta_rsp->status_code = status;
if (pStaDs) {
- pDelSta->staId = pStaDs->staIndex;
+ del_sta_rsp->sta_id = pStaDs->staIndex;
} else
- pDelSta->staId = STA_INVALID_IDX;
+ del_sta_rsp->sta_id = STA_INVALID_IDX;
- qdf_copy_macaddr(&pDelSta->peermac, &peerMac);
+ qdf_copy_macaddr(&del_sta_rsp->peermac, &peerMac);
- pDelSta->length = sizeof(tSirTdlsDelStaRsp);
- pDelSta->messageType = eWNI_SME_TDLS_DEL_STA_RSP;
- pDelSta->psoc = mac->psoc;
- mmhMsg.bodyptr = pDelSta;
- mmhMsg.callback = tgt_tdls_del_peer_rsp;
- return scheduler_post_message(QDF_MODULE_ID_PE,
- QDF_MODULE_ID_TDLS,
- QDF_MODULE_ID_TARGET_IF, &mmhMsg);
+ del_sta_rsp->psoc = mac->psoc;
+ msg.bodyptr = del_sta_rsp;
+ msg.callback = tgt_tdls_del_peer_rsp;
+ ret = scheduler_post_message(QDF_MODULE_ID_PE,
+ QDF_MODULE_ID_TDLS,
+ QDF_MODULE_ID_TARGET_IF, &msg);
+ if (QDF_IS_STATUS_ERROR(ret)) {
+ pe_err("post msg fail, %d", ret);
+ qdf_mem_free(del_sta_rsp);
+ }
+
+ return ret;
}
/*
diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
index afc269a..4014aef 100644
--- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -1075,33 +1075,33 @@
uint32_t sme_session_id,
uint32_t txCompleteStatus)
{
- struct scheduler_msg mmhMsg = {0};
- tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
+ struct scheduler_msg msg = {0};
+ struct tdls_mgmt_tx_completion_ind *mgmt_tx_completion_ind;
+ QDF_STATUS status;
- pSirMgmtTxCompletionInd =
- qdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
- if (!pSirMgmtTxCompletionInd)
+ mgmt_tx_completion_ind =
+ qdf_mem_malloc(sizeof(*mgmt_tx_completion_ind));
+ if (!mgmt_tx_completion_ind)
return;
- /* messageType */
- pSirMgmtTxCompletionInd->messageType =
- eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
- pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
/* sessionId */
- pSirMgmtTxCompletionInd->sessionId = sme_session_id;
+ mgmt_tx_completion_ind->session_id = sme_session_id;
- pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
+ mgmt_tx_completion_ind->tx_complete_status = txCompleteStatus;
- mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
- mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
- mmhMsg.bodyval = 0;
+ msg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
+ msg.bodyptr = mgmt_tx_completion_ind;
+ msg.bodyval = 0;
- pSirMgmtTxCompletionInd->psoc = mac->psoc;
- mmhMsg.callback = tgt_tdls_send_mgmt_tx_completion;
- scheduler_post_message(QDF_MODULE_ID_PE,
+ mgmt_tx_completion_ind->psoc = mac->psoc;
+ msg.callback = tgt_tdls_send_mgmt_tx_completion;
+ status = scheduler_post_message(QDF_MODULE_ID_PE,
QDF_MODULE_ID_TDLS,
- QDF_MODULE_ID_TARGET_IF, &mmhMsg);
- return;
+ QDF_MODULE_ID_TARGET_IF, &msg);
+ if (QDF_IS_STATUS_ERROR(status)) {
+ pe_err("post msg fail, %d", status);
+ qdf_mem_free(mgmt_tx_completion_ind);
+ }
} /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/
#endif /* FEATURE_WLAN_TDLS */