prima: Discard TDLS setup, if peer is removed by user application
qcacld-2.0 to prima propagation
In case of TDLS External Control, user app may delete a peer while
TDLS is initiated or setup is in progress. In those cases discard
TDLS Discovery Request, Setup Request and Setup Confirm if peer is
removed by user application.
Change-Id: Ieb3bec240f9d58ae8eba9180c26c8fa0aa9554df
CRs-Fixed: 907211
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index ce12ac1..d64356b 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -16846,6 +16846,7 @@
int responder;
long rc;
int ret;
+ hddTdlsPeer_t *pTdlsPeer;
#if !(TDLS_MGMT_VERSION2) && (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
u32 peer_capability = 0;
#endif
@@ -16990,7 +16991,6 @@
}
else
{
- hddTdlsPeer_t *pTdlsPeer;
mutex_lock(&pHddCtx->tdls_lock);
pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
@@ -17015,8 +17015,6 @@
if (SIR_MAC_TDLS_TEARDOWN == action_code)
{
- hddTdlsPeer_t *pTdlsPeer;
-
mutex_lock(&pHddCtx->tdls_lock);
pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
@@ -17034,6 +17032,24 @@
mutex_unlock(&pHddCtx->tdls_lock);
}
+ /* Discard TDLS setup if peer is removed by user app */
+ if ((pHddCtx->cfg_ini->fTDLSExternalControl) &&
+ ((SIR_MAC_TDLS_SETUP_REQ == action_code) ||
+ (SIR_MAC_TDLS_SETUP_CNF == action_code) ||
+ (SIR_MAC_TDLS_DIS_REQ == action_code))) {
+
+ mutex_lock(&pHddCtx->tdls_lock);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE);
+ if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) {
+ mutex_unlock(&pHddCtx->tdls_lock);
+ hddLog(LOGE, FL("TDLS External Control enabled, but peer "
+ MAC_ADDRESS_STR " is not forced, so reject the action code %d"),
+ MAC_ADDR_ARRAY(peer), action_code);
+ return -EINVAL;
+ }
+ mutex_unlock(&pHddCtx->tdls_lock);
+ }
+
/* For explicit trigger of DIS_REQ come out of BMPS for
successfully receiving DIS_RSP from peer. */
if ((SIR_MAC_TDLS_SETUP_RSP == action_code) ||