mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
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 hdd_roam_tdls_status _update_handler(), wlan_hdd_tdls_ct_sampling_tx_rx() and wlan_hdd_tdls_update_tx_pkt_cnt(). Change-Id: I7e3e74d149b3dfe527aeb01ee5b3d7a51b16fc61 CRs-Fixed: 2009223
This commit is contained in:
parent
ac07d5ad60
commit
8e86664ba5
2 changed files with 25 additions and 21 deletions
|
|
@ -3966,10 +3966,20 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
|
|||
break;
|
||||
}
|
||||
|
||||
mutex_lock(&pHddCtx->tdls_lock);
|
||||
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
|
||||
if (!pHddTdlsCtx) {
|
||||
mutex_unlock(&pHddCtx->tdls_lock);
|
||||
hdd_info("TDLS ctx is null, ignore roamResult (%d)",
|
||||
roamResult);
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
curr_peer =
|
||||
wlan_hdd_tdls_get_peer(pAdapter,
|
||||
pRoamInfo->peerMac.bytes,
|
||||
true);
|
||||
false);
|
||||
if (!curr_peer) {
|
||||
hdd_info("curr_peer is null");
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
|
|
@ -4002,6 +4012,7 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
|
|||
}
|
||||
status = QDF_STATUS_SUCCESS;
|
||||
}
|
||||
mutex_unlock(&pHddCtx->tdls_lock);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5439,7 +5439,6 @@ int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode)
|
|||
* wlan_hdd_tdls_ct_sampling_tx_rx() - collect tx/rx traffic sample
|
||||
* @adapter: pointer to hdd adapter
|
||||
* @hdd_ctx: hdd context
|
||||
* @tdls_ctx: tdls context
|
||||
*
|
||||
* Function to update data traffic information in tdls connection
|
||||
* tracker data structure for connection tracker operation
|
||||
|
|
@ -5447,8 +5446,7 @@ int hdd_set_tdls_offchannelmode(hdd_adapter_t *adapter, int offchanmode)
|
|||
* Return: None
|
||||
*/
|
||||
static void wlan_hdd_tdls_ct_sampling_tx_rx(hdd_adapter_t *adapter,
|
||||
hdd_context_t *hdd_ctx,
|
||||
tdlsCtx_t *tdls_ctx)
|
||||
hdd_context_t *hdd_ctx)
|
||||
{
|
||||
hddTdlsPeer_t *curr_peer;
|
||||
uint8_t mac[QDF_MAC_ADDR_SIZE];
|
||||
|
|
@ -5474,7 +5472,7 @@ static void wlan_hdd_tdls_ct_sampling_tx_rx(hdd_adapter_t *adapter,
|
|||
hdd_ctx->valid_mac_entries = 0;
|
||||
|
||||
qdf_spin_unlock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
|
||||
mutex_lock(&hdd_ctx->tdls_lock);
|
||||
for (mac_cnt = 0; mac_cnt < valid_mac_entries; mac_cnt++) {
|
||||
memcpy(mac, ct_peer_mac_table[mac_cnt].mac_address.bytes,
|
||||
QDF_MAC_ADDR_SIZE);
|
||||
|
|
@ -5486,6 +5484,7 @@ static void wlan_hdd_tdls_ct_sampling_tx_rx(hdd_adapter_t *adapter,
|
|||
ct_peer_mac_table[mac_cnt].rx_packet_cnt;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&hdd_ctx->tdls_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -5573,7 +5572,6 @@ void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
{
|
||||
hdd_context_t *hdd_ctx;
|
||||
hdd_station_ctx_t *hdd_sta_ctx;
|
||||
tdlsCtx_t *tdls_ctx;
|
||||
uint8_t mac_cnt;
|
||||
uint8_t valid_mac_entries;
|
||||
struct qdf_mac_addr *mac_addr;
|
||||
|
|
@ -5592,8 +5590,6 @@ void wlan_hdd_tdls_update_tx_pkt_cnt(hdd_adapter_t *adapter,
|
|||
QDF_MAC_ADDR_SIZE) == 0)
|
||||
return;
|
||||
|
||||
tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx;
|
||||
|
||||
qdf_spin_lock_bh(&hdd_ctx->tdls_ct_spinlock);
|
||||
valid_mac_entries = hdd_ctx->valid_mac_entries;
|
||||
|
||||
|
|
@ -6045,24 +6041,23 @@ static void wlan_hdd_tdls_ct_handler(void *user_data)
|
|||
|
||||
if (0 != (wlan_hdd_validate_context(hdd_ctx)))
|
||||
return;
|
||||
|
||||
mutex_lock(&hdd_ctx->tdls_lock);
|
||||
hdd_tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx;
|
||||
|
||||
if (NULL == hdd_tdls_ctx) {
|
||||
hdd_err("Invalid hdd_tdls_ctx context");
|
||||
/* If any concurrency is detected */
|
||||
if (!hdd_ctx->enable_tdls_connection_tracker) {
|
||||
hdd_info("Connection tracker is disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
/* If any concurrency is detected */
|
||||
if (!hdd_ctx->enable_tdls_connection_tracker)
|
||||
goto restart_return;
|
||||
|
||||
|
||||
|
||||
/* Update tx rx traffic sample in tdls data structures */
|
||||
wlan_hdd_tdls_ct_sampling_tx_rx(adapter, hdd_ctx,
|
||||
hdd_tdls_ctx);
|
||||
wlan_hdd_tdls_ct_sampling_tx_rx(adapter, hdd_ctx);
|
||||
|
||||
mutex_lock(&hdd_ctx->tdls_lock);
|
||||
hdd_tdls_ctx = WLAN_HDD_GET_TDLS_CTX_PTR(adapter);
|
||||
|
||||
if (NULL == hdd_tdls_ctx) {
|
||||
mutex_unlock(&hdd_ctx->tdls_lock);
|
||||
hdd_err("Invalid hdd_tdls_ctx context");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) {
|
||||
head = &hdd_tdls_ctx->peer_list[i];
|
||||
|
|
@ -6075,8 +6070,6 @@ static void wlan_hdd_tdls_ct_handler(void *user_data)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
restart_return:
|
||||
wlan_hdd_tdls_timer_restart(hdd_tdls_ctx->pAdapter,
|
||||
&hdd_tdls_ctx->peer_update_timer,
|
||||
hdd_tdls_ctx->threshold_config.tx_period_t);
|
||||
|
|
|
|||
Loading…
Reference in a new issue