From 3ed00d11baae895f4d37553c861cdf96e1745696 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Wed, 7 Mar 2018 11:16:57 +0530 Subject: [PATCH] qcacld-3.0: Avoid TDLS entry with MAC same as existing non-TDLS peer In lim_tdls_setup_add_sta() even if a pStaDs is already present and is a non TDLS peer, the driver proceed assuming it as TDLS peer and update its type and states. Now when driver tries to delete this non TDLS peer, as its states and type are modified it fails to properly clean up the peer. Fix it by allowing only TDLS entry to be updated. Also ignore if a entry is already present and the operation is TDLS add. Change-Id: I65fc73d65cdf768fd5b8afd050ca7314fd55c9ff CRs-Fixed: 2200498 --- core/mac/src/pe/lim/lim_process_tdls.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/mac/src/pe/lim/lim_process_tdls.c b/core/mac/src/pe/lim/lim_process_tdls.c index 00ea97a2da8d..4fd73f5eadde 100644 --- a/core/mac/src/pe/lim/lim_process_tdls.c +++ b/core/mac/src/pe/lim/lim_process_tdls.c @@ -2560,6 +2560,19 @@ static tSirRetStatus lim_tdls_setup_add_sta(tpAniSirGlobal pMac, pStaDs = dph_lookup_hash_entry(pMac, pAddStaReq->peermac.bytes, &aid, &psessionEntry->dph.dphHashTable); + + if (pStaDs && pAddStaReq->tdlsAddOper == TDLS_OPER_ADD) { + pe_err("TDLS entry for peer: "MAC_ADDRESS_STR " already exist, cannot add new entry", + MAC_ADDR_ARRAY(pAddStaReq->peermac.bytes)); + return eSIR_FAILURE; + } + + if (pStaDs && pStaDs->staType != STA_ENTRY_TDLS_PEER) { + pe_err("Non TDLS entry for peer: "MAC_ADDRESS_STR " already exist", + MAC_ADDR_ARRAY(pAddStaReq->peermac.bytes)); + return eSIR_FAILURE; + } + if (NULL == pStaDs) { aid = lim_assign_peer_idx(pMac, psessionEntry);