Pārlūkot izejas kodu

qcacmn: fix TX completion ring NULL pointer dereference issue

If IPA is enabled, index 1/2 in array soc->tx_comp_ring[] will
not be initialized, but initialize index 3/4 instead, if access
to index 1/2, NULL pointer dereference issue appeared.

use soc->num_tcl_data_rings as number of TX completion ring
wlan host interested, it differs between IPA enabled/disable case.

Change-Id: I92b4e2c9971f93136a9f4e60ae3de32140aa2477
CRs-Fixed: 3647677
Jinwei Chen 1 gadu atpakaļ
vecāks
revīzija
e8d518c82c
2 mainītis faili ar 13 papildinājumiem un 2 dzēšanām
  1. 7 1
      dp/wifi3.0/dp_main.c
  2. 6 1
      dp/wifi3.0/dp_stats.c

+ 7 - 1
dp/wifi3.0/dp_main.c

@@ -7207,9 +7207,15 @@ static inline void dp_srng_clear_ring_usage_wm_stats(struct dp_soc *soc)
 		hal_srng_clear_ring_usage_wm_locked(soc->hal_soc,
 					    soc->reo_dest_ring[ring].hal_srng);
 
-	for (ring = 0; ring < soc->num_tx_comp_rings; ring++)
+	for (ring = 0; ring < soc->num_tcl_data_rings; ring++) {
+		if (wlan_cfg_get_wbm_ring_num_for_index(
+					soc->wlan_cfg_ctx, ring) ==
+		    INVALID_WBM_RING_NUM)
+			continue;
+
 		hal_srng_clear_ring_usage_wm_locked(soc->hal_soc,
 					soc->tx_comp_ring[ring].hal_srng);
+	}
 }
 #else
 static inline void dp_srng_clear_ring_usage_wm_stats(struct dp_soc *soc)

+ 6 - 1
dp/wifi3.0/dp_stats.c

@@ -8374,7 +8374,12 @@ void dp_dump_srng_high_wm_stats(struct dp_soc *soc, uint64_t srng_mask)
 	}
 
 	if (srng_mask & DP_SRNG_WM_MASK_TX_COMP) {
-		for (ring = 0; ring < soc->num_tx_comp_rings; ring++) {
+		for (ring = 0; ring < soc->num_tcl_data_rings; ring++) {
+			if (wlan_cfg_get_wbm_ring_num_for_index(
+						soc->wlan_cfg_ctx, ring) ==
+			    INVALID_WBM_RING_NUM)
+				continue;
+
 			pos = 0;
 			pos += hal_dump_srng_high_wm_stats(soc->hal_soc,
 					soc->tx_comp_ring[ring].hal_srng,