TDLS : Protect the Adapter access with a mutex.
The adapter accesses by the TDLS code is not protected with the
concurrent access of the same by the cfg80211 callbacks (add / del
interface, change interface) and thus results in a kernel panic.This
commit provides the concurrent access to the adapter through a mutex.
Change-Id: I1bb9845097b40ba7d622950a119e934731c822b9
CRs-fixed: 546843
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index e8432af..c907d56 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -2285,7 +2285,7 @@
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
("HDD: del STA IDX = %x"), pRoamInfo->staId) ;
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
if (NULL != curr_peer && TDLS_IS_CONNECTED(curr_peer))
{
hdd_roamDeregisterTDLSSTA ( pAdapter, pRoamInfo->staId );
@@ -2314,7 +2314,7 @@
__func__, pRoamInfo->reasonCode);
#ifdef CONFIG_TDLS_IMPLICIT
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, pRoamInfo->peerMac, TRUE);
wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, pRoamInfo->reasonCode);
#endif
status = eHAL_STATUS_SUCCESS ;
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 9787000..3abd444 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2710,13 +2710,28 @@
hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE);
}
}
+#ifdef FEATURE_WLAN_TDLS
+ /* A Mutex Lock is introduced while changing the mode to
+ * 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;
+ }
+#endif
//De-init the adapter.
hdd_stop_adapter( pHddCtx, pAdapter );
hdd_deinit_adapter( pHddCtx, pAdapter );
memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO;
+#ifdef FEATURE_WLAN_TDLS
+ mutex_unlock(&pHddCtx->tdls_lock);
+#endif
//Disable BMPS and IMPS if enabled
//before starting Go
@@ -2793,6 +2808,19 @@
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_ADHOC:
+#ifdef FEATURE_WLAN_TDLS
+
+ /* A Mutex Lock is introduced while changing the mode to
+ * 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;
+ }
+#endif
hdd_stop_adapter( pHddCtx, pAdapter );
hdd_deinit_adapter( pHddCtx, pAdapter );
wdev->iftype = type;
@@ -2812,6 +2840,9 @@
memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
hdd_set_station_ops( pAdapter->dev );
status = hdd_init_station_mode( pAdapter );
+#ifdef FEATURE_WLAN_TDLS
+ mutex_unlock(&pHddCtx->tdls_lock);
+#endif
if( VOS_STATUS_SUCCESS != status )
return -EOPNOTSUPP;
/* In case of JB, for P2P-GO, only change interface will be called,
@@ -2931,7 +2962,7 @@
return -EBUSY;
}
- pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if ( NULL == pTdlsPeer ) {
VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
@@ -2965,7 +2996,7 @@
}
/* when others are on-going, we want to change link_status to idle */
- if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE))
+ if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE))
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: " MAC_ADDRESS_STR
@@ -2988,7 +3019,7 @@
else
{
hddTdlsPeer_t *pTdlsPeer;
- pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -7881,7 +7912,7 @@
if (WLAN_IS_TDLS_SETUP_ACTION(action_code))
{
- if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE))
+ if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE))
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: " MAC_ADDRESS_STR
@@ -7925,7 +7956,7 @@
else
{
hddTdlsPeer_t *pTdlsPeer;
- pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -7950,7 +7981,7 @@
{
hddTdlsPeer_t *pTdlsPeer;
- pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE);
if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer))
responder = pTdlsPeer->is_responder;
@@ -8078,7 +8109,7 @@
return status;
}
- pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer);
+ pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE);
if ( NULL == pTdlsPeer ) {
hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR " (oper %d) not exsting. ignored",
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 71bfa8f..66d5fae 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4912,6 +4912,18 @@
if( NULL == pAdapter )
return NULL;
+#ifdef FEATURE_WLAN_TDLS
+ /* A Mutex Lock is introduced while changing/initializing the mode to
+ * 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 NULL;
+ }
+#endif
+
pAdapter->wdev.iftype = (session_type == WLAN_HDD_P2P_CLIENT) ?
NL80211_IFTYPE_P2P_CLIENT:
NL80211_IFTYPE_STATION;
@@ -4919,6 +4931,9 @@
pAdapter->device_mode = session_type;
status = hdd_init_station_mode( pAdapter );
+#ifdef FEATURE_WLAN_TDLS
+ mutex_unlock(&pHddCtx->tdls_lock);
+#endif
if( VOS_STATUS_SUCCESS != status )
goto err_free_netdev;
@@ -5113,9 +5128,27 @@
{
wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode);
hdd_cleanup_adapter( pHddCtx, pAdapterNode->pAdapter, rtnl_held );
+
+#ifdef FEATURE_WLAN_TDLS
+
+ /* A Mutex Lock is introduced while changing/initializing the mode to
+ * 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 VOS_STATUS_E_FAILURE;
+ }
+#endif
+
hdd_remove_adapter( pHddCtx, pAdapterNode );
vos_mem_free( pAdapterNode );
+#ifdef FEATURE_WLAN_TDLS
+ mutex_unlock(&pHddCtx->tdls_lock);
+#endif
+
/* If there is a single session of STA/P2P client, re-enable BMPS */
if ((!vos_concurrent_sessions_running()) &&
@@ -6698,6 +6731,14 @@
hdd_list_init( &pHddCtx->hddAdapters, MAX_NUMBER_OF_ADAPTERS );
+#ifdef FEATURE_WLAN_TDLS
+ /* tdls_lock is initialized before an hdd_open_adapter ( which is
+ * invoked by other instances also) to protect the concurrent
+ * access for the Adapters by TDLS module.
+ */
+ mutex_init(&pHddCtx->tdls_lock);
+#endif
+
// Load all config first as TL config is needed during vos_open
pHddCtx->cfg_ini = (hdd_config_t*) kmalloc(sizeof(hdd_config_t), GFP_KERNEL);
if(pHddCtx->cfg_ini == NULL)
@@ -7161,9 +7202,6 @@
}
mutex_init(&pHddCtx->sap_lock);
-#ifdef FEATURE_WLAN_TDLS
- mutex_init(&pHddCtx->tdls_lock);
-#endif
pHddCtx->isLoadUnloadInProgress = FALSE;
diff --git a/CORE/HDD/src/wlan_hdd_tdls.c b/CORE/HDD/src/wlan_hdd_tdls.c
index 87e5723..3ed2c62 100644
--- a/CORE/HDD/src/wlan_hdd_tdls.c
+++ b/CORE/HDD/src/wlan_hdd_tdls.c
@@ -678,23 +678,20 @@
tdlsCtx_t *pHddTdlsCtx;
hdd_context_t *pHddCtx;
+ /*
+ * NOTE: The Callers of this function should ensure to acquire the
+ * tdls_lock to avoid any concurrent access to the Adapter.
+ */
+
pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
if (NULL == pHddCtx)
{
return;
}
- if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: unable to lock list", __func__);
- return;
- }
-
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL == pHddTdlsCtx)
{
- mutex_unlock(&pHddCtx->tdls_lock);
hddLog(VOS_TRACE_LEVEL_WARN, "%s TDLS not enabled, exiting!", __func__);
return;
}
@@ -708,7 +705,6 @@
vos_mem_free(pHddTdlsCtx);
pHddTdlsCtx = NULL;
- mutex_unlock(&pHddCtx->tdls_lock);
}
/* stop all monitoring timers per Adapter */
@@ -810,7 +806,7 @@
if ((NULL == pHddCtx)) return NULL;
/* if already there, just update */
- peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (peer != NULL)
{
return peer;
@@ -895,7 +891,7 @@
{
hddTdlsPeer_t *curr_peer;
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (curr_peer == NULL)
return;
@@ -908,6 +904,15 @@
{
hddTdlsPeer_t *curr_peer;
tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+ hdd_context_t *pHddCtx;
+
+ if ( NULL == pHddTdlsCtx )
+ return -1;
+
+ pHddCtx = WLAN_HDD_GET_CTX(pHddTdlsCtx->pAdapter);
+
+ if (NULL == pHddCtx)
+ return -1;
curr_peer = wlan_hdd_tdls_get_peer(pAdapter, mac);
@@ -917,7 +922,16 @@
if (pHddTdlsCtx->discovery_sent_cnt)
pHddTdlsCtx->discovery_sent_cnt--;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return -1;
+ }
+
wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
+
+ mutex_unlock(&pHddCtx->tdls_lock);
if (0 == pHddTdlsCtx->discovery_sent_cnt)
{
vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer);
@@ -997,7 +1011,7 @@
{
hddTdlsPeer_t *curr_peer;
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (curr_peer == NULL)
return -1;
@@ -1023,7 +1037,7 @@
{
hddTdlsPeer_t *curr_peer;
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (curr_peer == NULL)
return -1;
@@ -1213,7 +1227,8 @@
/* if peerMac is found, then it returns pointer to hddTdlsPeer_t
otherwise, it returns NULL
*/
-hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac)
+hddTdlsPeer_t *wlan_hdd_tdls_find_peer(hdd_adapter_t *pAdapter, u8 *mac,
+ tANI_BOOLEAN mutexLock)
{
u8 key;
struct list_head *pos;
@@ -1224,16 +1239,20 @@
if ((NULL == pHddCtx)) return NULL;
- if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ if ( mutexLock )
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: unable to lock list", __func__);
- return NULL;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return NULL;
+ }
}
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL == pHddTdlsCtx)
{
- mutex_unlock(&pHddCtx->tdls_lock);
+ if ( mutexLock )
+ mutex_unlock(&pHddCtx->tdls_lock);
return NULL;
}
@@ -1246,12 +1265,13 @@
if (!memcmp(mac, curr_peer->peerMac, 6)) {
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
"findTdlsPeer: found staId %d", curr_peer->staId);
- mutex_unlock(&pHddCtx->tdls_lock);
+ if ( mutexLock )
+ mutex_unlock(&pHddCtx->tdls_lock);
return curr_peer;
}
}
-
- mutex_unlock(&pHddCtx->tdls_lock);
+ if ( mutexLock )
+ mutex_unlock(&pHddCtx->tdls_lock);
return NULL;
}
@@ -1263,6 +1283,12 @@
hddTdlsPeer_t *curr_peer= NULL;
VOS_STATUS status = 0;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return NULL;
+ }
status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
{
@@ -1271,13 +1297,17 @@
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL != pHddTdlsCtx)
{
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE);
if (curr_peer)
+ {
+ mutex_unlock(&pHddCtx->tdls_lock);
return curr_peer;
+ }
}
status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
pAdapterNode = pNext;
}
+ mutex_unlock(&pHddCtx->tdls_lock);
return curr_peer;
}
@@ -1521,11 +1551,20 @@
if (NULL == pHddCtx) return;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return;
+ }
+
pHddCtx->connected_peer_count++;
wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
__func__, pHddCtx->connected_peer_count);
+
+ mutex_unlock(&pHddCtx->tdls_lock);
}
void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter)
@@ -1534,6 +1573,13 @@
if (NULL == pHddCtx) return;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return;
+ }
+
if (pHddCtx->connected_peer_count)
pHddCtx->connected_peer_count--;
wlan_hdd_tdls_check_power_save_prohibited(pAdapter);
@@ -1541,6 +1587,8 @@
VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
__func__, pHddCtx->connected_peer_count);
+ mutex_unlock(&pHddCtx->tdls_lock);
+
}
void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter)
@@ -1551,7 +1599,7 @@
if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) return;
- curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, TRUE);
+ curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
if (NULL != curr_peer)
{
VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
@@ -1588,7 +1636,7 @@
{
hddTdlsPeer_t *curr_peer;
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if (curr_peer == NULL)
return 0;
@@ -1600,34 +1648,17 @@
* skip_self - if TRUE, skip this mac. otherwise, check all the peer list. if
mac is NULL, this argument is ignored, and check for all the peer list.
*/
-static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter, u8 *mac, u8 skip_self, tANI_BOOLEAN mutexLock)
+static hddTdlsPeer_t *wlan_hdd_tdls_find_progress_peer(hdd_adapter_t *pAdapter, u8 *mac, u8 skip_self)
{
int i;
struct list_head *head;
hddTdlsPeer_t *curr_peer;
struct list_head *pos;
- tdlsCtx_t *pHddTdlsCtx;
- hdd_context_t *pHddCtx;
+ tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);;
- pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL == pHddTdlsCtx)
return NULL;
- pHddCtx = WLAN_HDD_GET_CTX( pHddTdlsCtx->pAdapter );
-
- if (NULL == pHddCtx)
- return NULL;
-
- if (mutexLock)
- {
- if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: unable to lock list", __func__);
- return NULL;
- }
- }
-
for (i = 0; i < 256; i++) {
head = &pHddTdlsCtx->peer_list[i];
list_for_each(pos, head) {
@@ -1642,20 +1673,15 @@
VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
"%s:" MAC_ADDRESS_STR " eTDLS_LINK_CONNECTING",
__func__, MAC_ADDR_ARRAY(curr_peer->peerMac));
- if (mutexLock)
- mutex_unlock(&pHddCtx->tdls_lock);
return curr_peer;
}
}
}
}
-
- if (mutexLock)
- mutex_unlock(&pHddCtx->tdls_lock);
return NULL;
}
-hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, u8 *mac, u8 skip_self, tANI_BOOLEAN mutexLock)
+hddTdlsPeer_t *wlan_hdd_tdls_is_progress(hdd_context_t *pHddCtx, u8 *mac, u8 skip_self)
{
hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
hdd_adapter_t *pAdapter = NULL;
@@ -1663,6 +1689,13 @@
hddTdlsPeer_t *curr_peer= NULL;
VOS_STATUS status = 0;
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return NULL;
+ }
+
status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
{
@@ -1671,13 +1704,17 @@
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL != pHddTdlsCtx)
{
- curr_peer = wlan_hdd_tdls_find_progress_peer(pAdapter, mac, skip_self, mutexLock);
+ curr_peer = wlan_hdd_tdls_find_progress_peer(pAdapter, mac, skip_self);
if (curr_peer)
+ {
+ mutex_unlock(&pHddCtx->tdls_lock);
return curr_peer;
+ }
}
status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
pAdapterNode = pNext;
}
+ mutex_unlock(&pHddCtx->tdls_lock);
return NULL;
}
@@ -1793,7 +1830,7 @@
hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
}
- temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, FALSE);
+ temp_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
if (NULL != temp_peer)
{
VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: " MAC_ADDRESS_STR " ongoing. pre_setup ignored\n",
@@ -1818,7 +1855,17 @@
}
pHddTdlsCtx->discovery_sent_cnt++;
+
+ if (mutex_lock_interruptible(&pHddCtx->tdls_lock))
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: unable to lock list", __func__);
+ return;
+ }
+
wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
+
+ mutex_unlock(&pHddCtx->tdls_lock);
VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: discovery count %lu timeout %lu msec",
__func__, pHddTdlsCtx->discovery_sent_cnt,
pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
@@ -1976,7 +2023,7 @@
if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode)
return 1;
- curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0, TRUE);
+ curr_peer = wlan_hdd_tdls_is_progress(pHddCtx, NULL, 0);
if (NULL != curr_peer)
{
if (pHddCtx->tdls_scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT)
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
index 3aeb165..24eb2fd 100644
--- a/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -1471,7 +1471,7 @@
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED,
"rx extract mac:" MAC_ADDRESS_STR,
MAC_ADDR_ARRAY(mac) );
- curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac);
+ curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE);
if ((NULL != curr_peer) && (eTDLS_LINK_CONNECTED == curr_peer->link_status)
&& (TRUE == pRxMetaInfo->isStaTdls))
{