diff options
| author | Naveen Rawat <naveenrawat@codeaurora.org> | 2017-03-02 18:43:16 -0800 |
|---|---|---|
| committer | Prakash Dhavali <pdhavali@codeaurora.org> | 2017-03-09 21:08:38 -0800 |
| commit | b5f326883c02db3717cbb9c8d073e0060844e986 (patch) | |
| tree | c259d0ae5762bb1f2125dd8d842e63b3c8afe64b | |
| parent | 3b3cc65bcd26c0799e95940374690dc1313f819d (diff) | |
qcacld-3.0: Free stats_rsp in vdev_detach before zeroing iface buffer
1) In function wma_vdev_detach_callback, free stats_rsp before zeroing out
iface buffer, else the stats_rsp memory which is not sent to upper layer is
lost.
2) In function wma_get_stats_req set stats_rsp buffer to NULL after
posting it to upper layers, so that in case this function is pre-empted
we do not lose buffer pointer.
Change-Id: I8d6261cb53758e02217d68ff01b94bb812adc7fd
CRs-Fixed: 2015436
| -rw-r--r-- | core/wma/src/wma_dev_if.c | 4 | ||||
| -rw-r--r-- | core/wma/src/wma_utils.c | 24 |
2 files changed, 19 insertions, 9 deletions
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 181edb69fbf0..598ef9f00011 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -444,6 +444,10 @@ static void wma_vdev_detach_callback(void *ctx) if (iface->staKeyParams) qdf_mem_free(iface->staKeyParams); + + if (iface->stats_rsp) + qdf_mem_free(iface->stats_rsp); + qdf_mem_zero(iface, sizeof(*iface)); param->status = QDF_STATUS_SUCCESS; sme_msg.type = eWNI_SME_DEL_STA_SELF_RSP; diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index b293d4b1cfe6..d7401eb677cb 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -1511,11 +1511,8 @@ static void wma_update_vdev_stats(tp_wma_handle wma, */ static void wma_post_stats(tp_wma_handle wma, struct wma_txrx_node *node) { - tAniGetPEStatsRsp *stats_rsp_params; - - stats_rsp_params = node->stats_rsp; /* send response to UMAC */ - wma_send_msg(wma, WMA_GET_STATISTICS_RSP, (void *)stats_rsp_params, 0); + wma_send_msg(wma, WMA_GET_STATISTICS_RSP, node->stats_rsp, 0); node->stats_rsp = NULL; node->fw_stats_set = 0; } @@ -1541,10 +1538,10 @@ static void wma_update_peer_stats(tp_wma_handle wma, return; node = &wma->interfaces[vdev_id]; - if (node->stats_rsp) { + stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp; + if (stats_rsp_params) { node->fw_stats_set |= FW_PEER_STATS_SET; WMA_LOGD("<-- FW PEER STATS received for vdevId:%d", vdev_id); - stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp; stats_buf = (uint8_t *) (stats_rsp_params + 1); temp_mask = stats_rsp_params->statsMask; if (temp_mask & (1 << eCsrSummaryStats)) @@ -1679,11 +1676,11 @@ static void wma_update_rssi_stats(tp_wma_handle wma, vdev_id = rssi_stats->vdev_id; node = &wma->interfaces[vdev_id]; - if (node->stats_rsp) { + stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp; + if (stats_rsp_params) { node->fw_stats_set |= FW_RSSI_PER_CHAIN_STATS_SET; WMA_LOGD("<-- FW RSSI PER CHAIN STATS received for vdevId:%d", vdev_id); - stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp; stats_buf = (uint8_t *) (stats_rsp_params + 1); temp_mask = stats_rsp_params->statsMask; @@ -2374,7 +2371,16 @@ void wma_get_stats_req(WMA_HANDLE handle, goto end; node->fw_stats_set = 0; + if (node->stats_rsp) { + WMA_LOGD(FL("stats_rsp is not null, prev_value: %p"), + node->stats_rsp); + qdf_mem_free(node->stats_rsp); + node->stats_rsp = NULL; + } node->stats_rsp = pGetPEStatsRspParams; + WMA_LOGD("stats_rsp allocated: %p, sta_id: %d, mask: %d, vdev_id: %d", + node->stats_rsp, node->stats_rsp->staId, + node->stats_rsp->statsMask, get_stats_param->sessionId); cmd.session_id = get_stats_param->sessionId; if (wmi_unified_get_stats_cmd(wma_handle->wmi_handle, &cmd, @@ -2389,10 +2395,10 @@ void wma_get_stats_req(WMA_HANDLE handle, failed: pGetPEStatsRspParams->rc = QDF_STATUS_E_FAILURE; - node->stats_rsp = NULL; /* send response to UMAC */ wma_send_msg(wma_handle, WMA_GET_STATISTICS_RSP, pGetPEStatsRspParams, 0); + node->stats_rsp = NULL; end: qdf_mem_free(get_stats_param); WMA_LOGD("%s: Exit", __func__); |
