From a6b0982b349650e277ca46bb6f77bf4688cf3315 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 8 Aug 2016 18:18:11 +0530 Subject: qcacld-3.0: Avoid sending P2P action frame confirmation twice qcacld-2.0 to qcacld-3.0 propagation.. P2P action frame confirmation can be called from work queue wma_mgmt_tx_ack_work_handler as well as from MC thread during remain on channel completion. So it can lead to race condition where frame confirmation is called twice and driver tries to free frame buffer twice. To detect duplicate use PE global lock in P2P action frame confirmation. Change-Id: Id193b5a979fad5effa7c6b00d89452ad876ae00e CRs-Fixed: 1035077 --- core/mac/src/pe/lim/lim_p2p.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/core/mac/src/pe/lim/lim_p2p.c b/core/mac/src/pe/lim/lim_p2p.c index cda4b103c845..9485f127d6e1 100644 --- a/core/mac/src/pe/lim/lim_p2p.c +++ b/core/mac/src/pe/lim/lim_p2p.c @@ -412,16 +412,31 @@ void lim_send_sme_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameType, QDF_STATUS lim_p2p_action_cnf(tpAniSirGlobal pMac, uint32_t txCompleteSuccess) { - if (pMac->lim.mgmtFrameSessionId != 0xff) { - /* The session entry might be invalid(0xff) action confirmation received after - * remain on channel timer expired */ - if (pMac->p2p_ack_ind_cb) - pMac->p2p_ack_ind_cb(pMac->lim.mgmtFrameSessionId, - txCompleteSuccess); + QDF_STATUS status; + uint32_t mgmt_frame_sessionId; + + status = pe_acquire_global_lock(&pMac->lim); + if (QDF_IS_STATUS_SUCCESS(status)) { + mgmt_frame_sessionId = pMac->lim.mgmtFrameSessionId; pMac->lim.mgmtFrameSessionId = 0xff; + pe_release_global_lock(&pMac->lim); + + if (mgmt_frame_sessionId != 0xff) { + /* + * The session entry might be invalid(0xff) + * action confirmation received after + * remain on channel timer expired. + */ + lim_log(pMac, LOG1, + FL("mgmt_frame_sessionId %d"), + mgmt_frame_sessionId); + if (pMac->p2p_ack_ind_cb) + pMac->p2p_ack_ind_cb(mgmt_frame_sessionId, + txCompleteSuccess); + } } - return QDF_STATUS_SUCCESS; + return status; } /** -- cgit v1.2.3