TDLS: replace mutex_lock_interruptible with mutex_lock for tdls lock
Use mutex_lock instead of mutex_lock_interruptible to avoid race
condition which can occur due to interrupts.
Change-Id: I9ba790926e0b9467e7d2fc2aae0e1d5169231045
CRs-Fixed: 637112
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 078177f..7737547 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2957,12 +2957,7 @@
* protect the concurrent access for the Adapters by TDLS
* module.
*/
- if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: unable to lock list", __func__);
- return -EINVAL;
- }
+ mutex_lock(&pHddCtx->tdls_lock);
#endif
//De-init the adapter.
hdd_stop_adapter( pHddCtx, pAdapter );
@@ -3094,12 +3089,7 @@
* protect the concurrent access for the Adapters by TDLS
* module.
*/
- if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: unable to lock list", __func__);
- return -EINVAL;
- }
+ mutex_lock(&pHddCtx->tdls_lock);
#endif
hdd_stop_adapter( pHddCtx, pAdapter );
hdd_deinit_adapter( pHddCtx, pAdapter );
@@ -3222,6 +3212,7 @@
VOS_STATUS status;
hddTdlsPeer_t *pTdlsPeer;
long ret;
+ tANI_U16 numCurrTdlsPeers;
ENTER();
@@ -3296,12 +3287,15 @@
/* first to check if we reached to maximum supported TDLS peer.
TODO: for now, return -EPERM looks working fine,
but need to check if any other errno fit into this category.*/
- if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter))
+ numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
+ if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers)
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: " MAC_ADDRESS_STR
- " TDLS Max peer already connected. Request declined.",
- __func__, MAC_ADDR_ARRAY(mac));
+ " TDLS Max peer already connected. Request declined."
+ " Num of peers (%d), Max allowed (%d).",
+ __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers,
+ HDD_MAX_NUM_TDLS_STA);
goto error;
}
else
@@ -8711,6 +8705,7 @@
#if !(TDLS_MGMT_VERSION2)
u32 peer_capability = 0;
#endif
+ tANI_U16 numCurrTdlsPeers;
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_TDLS_MGMT,
@@ -8769,7 +8764,8 @@
if (SIR_MAC_TDLS_SETUP_REQ == action_code ||
SIR_MAC_TDLS_SETUP_RSP == action_code )
{
- if (HDD_MAX_NUM_TDLS_STA <= wlan_hdd_tdlsConnectedPeers(pAdapter))
+ numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter);
+ if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers)
{
/* supplicant still sends tdls_mgmt(SETUP_REQ) even after
we return error code at 'add_station()'. Hence we have this
@@ -8779,8 +8775,9 @@
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: " MAC_ADDRESS_STR
- " TDLS Max peer already connected. action %d declined.",
- __func__, MAC_ADDR_ARRAY(peer), action_code);
+ " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).",
+ __func__, MAC_ADDR_ARRAY(peer), action_code,
+ numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA);
return -EINVAL;
}
else
@@ -8790,8 +8787,9 @@
status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS;
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: " MAC_ADDRESS_STR
- " TDLS Max peer already connected send response status %d",
- __func__, MAC_ADDR_ARRAY(peer), status_code);
+ " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).",
+ __func__, MAC_ADDR_ARRAY(peer), status_code,
+ numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA);
max_sta_failed = -EPERM;
/* fall through to send setup resp with failure status
code */