qcacld-3.0: Add NULL check for tx_rx_hist

Currently, we are updating tx_rx_hist without performing a NULL check.
There can be the case where the tx_rx_hist is freed and we are trying to
de-reference the tx_rx_hist, which will cause the NULL pointer dereference
issue.

Fix is to add NULL check for tx_rx_hist before dereferencing it.

Change-Id: I0c298f1c86dd86b6ac987c005ed19b20933ffba8
CRs-Fixed: 3196312
此提交包含在:
Amit Mehta
2022-05-12 17:49:07 +05:30
提交者 Madan Koyyalamudi
父節點 8154bddf2a
當前提交 cd59c3f232

查看文件

@@ -1612,18 +1612,22 @@ static void dp_pld_request_bus_bandwidth(struct wlan_dp_psoc_context *dp_ctx,
is_tx_pm_qos_high,
qdf_cpumask_pr_args(&pm_qos_cpu_mask_tx));
dp_ctx->txrx_hist[index].next_tx_level = next_tx_level;
dp_ctx->txrx_hist[index].next_rx_level = next_rx_level;
dp_ctx->txrx_hist[index].is_rx_pm_qos_high =
is_rx_pm_qos_high;
dp_ctx->txrx_hist[index].is_tx_pm_qos_high =
is_tx_pm_qos_high;
dp_ctx->txrx_hist[index].next_vote_level = next_vote_level;
dp_ctx->txrx_hist[index].interval_rx = rx_packets;
dp_ctx->txrx_hist[index].interval_tx = tx_packets;
dp_ctx->txrx_hist[index].qtime = qdf_get_log_timestamp();
dp_ctx->txrx_hist_idx++;
dp_ctx->txrx_hist_idx &= NUM_TX_RX_HISTOGRAM_MASK;
if (dp_ctx->txrx_hist) {
dp_ctx->txrx_hist[index].next_tx_level = next_tx_level;
dp_ctx->txrx_hist[index].next_rx_level = next_rx_level;
dp_ctx->txrx_hist[index].is_rx_pm_qos_high =
is_rx_pm_qos_high;
dp_ctx->txrx_hist[index].is_tx_pm_qos_high =
is_tx_pm_qos_high;
dp_ctx->txrx_hist[index].next_vote_level =
next_vote_level;
dp_ctx->txrx_hist[index].interval_rx = rx_packets;
dp_ctx->txrx_hist[index].interval_tx = tx_packets;
dp_ctx->txrx_hist[index].qtime =
qdf_get_log_timestamp();
dp_ctx->txrx_hist_idx++;
dp_ctx->txrx_hist_idx &= NUM_TX_RX_HISTOGRAM_MASK;
}
}
/* Roaming is a high priority job but gets processed in scheduler