Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94962f3d authored by Amit Mehta's avatar Amit Mehta
Browse files

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
parent 110644ce
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -10422,18 +10422,24 @@ static void hdd_pld_request_bus_bandwidth(struct hdd_context *hdd_ctx,
			  is_tx_pm_qos_high,
			  cpumask_pr_args(&pm_qos_cpu_mask_tx));
		hdd_ctx->hdd_txrx_hist[index].next_tx_level = next_tx_level;
		hdd_ctx->hdd_txrx_hist[index].next_rx_level = next_rx_level;
		if (hdd_ctx->hdd_txrx_hist) {
			hdd_ctx->hdd_txrx_hist[index].next_tx_level =
				next_tx_level;
			hdd_ctx->hdd_txrx_hist[index].next_rx_level =
				next_rx_level;
			hdd_ctx->hdd_txrx_hist[index].is_rx_pm_qos_high =
				is_rx_pm_qos_high;
			hdd_ctx->hdd_txrx_hist[index].is_tx_pm_qos_high =
				is_tx_pm_qos_high;
		hdd_ctx->hdd_txrx_hist[index].next_vote_level = next_vote_level;
			hdd_ctx->hdd_txrx_hist[index].next_vote_level =
				next_vote_level;
			hdd_ctx->hdd_txrx_hist[index].interval_rx = rx_packets;
			hdd_ctx->hdd_txrx_hist[index].interval_tx = tx_packets;
		hdd_ctx->hdd_txrx_hist[index].qtime = qdf_get_log_timestamp();
			hdd_ctx->hdd_txrx_hist[index].qtime =
				qdf_get_log_timestamp();
			hdd_ctx->hdd_txrx_hist_idx++;
			hdd_ctx->hdd_txrx_hist_idx &= NUM_TX_RX_HISTOGRAM_MASK;
		}
		/* Clear all the mask if no silver/gold vote is required */
		if (next_vote_level < PLD_BUS_WIDTH_MEDIUM)