qcacld-3.0: Acquire mutex before accessing tdls context

peer_list is a parameter for tdls_ctx, so every access to
peer_list should be protected with mutex lock.

This change refactors the code for function hdd_roam_tdls
_status_update_handler().

Change-Id: Id4fd0931df5ec38ad07657751feff34946a18c02
CRs-Fixed: 1106735
This commit is contained in:
Nitesh Shah
2017-02-01 14:35:57 +05:30
committed by qcabuildsw
parent 4ea2715f34
commit 3dea6721dc

View File

@@ -3806,17 +3806,18 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
pHddCtx->tdlsConnInfo[staIdx].staId) { pHddCtx->tdlsConnInfo[staIdx].staId) {
hdd_warn("HDD: del STA IDX = %x", hdd_warn("HDD: del STA IDX = %x",
pRoamInfo->staId); pRoamInfo->staId);
mutex_lock(&pHddCtx->tdls_lock);
curr_peer = curr_peer =
wlan_hdd_tdls_find_peer(pAdapter, wlan_hdd_tdls_find_peer(pAdapter,
pRoamInfo-> pRoamInfo->
peerMac.bytes, peerMac.bytes,
true); false);
if (NULL != curr_peer) { if (NULL != curr_peer) {
hdd_info("Current status for peer " MAC_ADDRESS_STR " is %d", hdd_info("Current status for peer " MAC_ADDRESS_STR " is %d",
MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes),
curr_peer->link_status); curr_peer->link_status);
if (TDLS_IS_CONNECTED(curr_peer)) { if (TDLS_IS_CONNECTED(curr_peer)) {
mutex_unlock(&pHddCtx->tdls_lock);
hdd_roam_deregister_tdlssta hdd_roam_deregister_tdlssta
(pAdapter, (pAdapter,
pRoamInfo->staId); pRoamInfo->staId);
@@ -3824,11 +3825,14 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
(pAdapter); (pAdapter);
} else if (eTDLS_LINK_CONNECTING == } else if (eTDLS_LINK_CONNECTING ==
curr_peer->link_status) { curr_peer->link_status) {
mutex_unlock(&pHddCtx->tdls_lock);
hdd_roam_deregister_tdlssta hdd_roam_deregister_tdlssta
(pAdapter, (pAdapter,
pRoamInfo->staId); pRoamInfo->staId);
} }
} } else
mutex_unlock(&pHddCtx->tdls_lock);
wlan_hdd_tdls_reset_peer(pAdapter, wlan_hdd_tdls_reset_peer(pAdapter,
pRoamInfo-> pRoamInfo->
peerMac.bytes); peerMac.bytes);