Browse Source

qcacmn: Check the max value for max desc before using

Check the max value for max desc extracted from cfg
before using it for actual allocation of tx descs.

Change-Id: I9bd6c88f136870a42596afbf25328965fce959be
CRs-fixed: 2614329
Pavankumar Nandeshwar 5 năm trước cách đây
mục cha
commit
0d8578f313
1 tập tin đã thay đổi với 6 bổ sung5 xóa
  1. 6 5
      dp/wifi3.0/dp_tx.c

+ 6 - 5
dp/wifi3.0/dp_tx.c

@@ -4290,7 +4290,12 @@ QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc)
 	num_desc = wlan_cfg_get_num_tx_desc(soc->wlan_cfg_ctx);
 	num_ext_desc = wlan_cfg_get_num_tx_ext_desc(soc->wlan_cfg_ctx);
 
-	if (num_pool > MAX_TXDESC_POOLS)
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
+		  "%s Tx Desc Alloc num_pool = %d, descs = %d",
+		  __func__, num_pool, num_desc);
+
+	if ((num_pool > MAX_TXDESC_POOLS) ||
+	    (num_desc > WLAN_CFG_NUM_TX_DESC_MAX))
 		goto fail;
 
 	if (dp_tx_alloc_static_pools(soc, num_pool, num_desc))
@@ -4298,10 +4303,6 @@ QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc)
 
 	dp_tx_flow_control_init(soc);
 
-	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
-			"%s Tx Desc Alloc num_pool = %d, descs = %d",
-			__func__, num_pool, num_desc);
-
 	/* Allocate extension tx descriptor pools */
 	for (i = 0; i < num_pool; i++) {
 		if (dp_tx_ext_desc_pool_alloc(soc, i, num_ext_desc)) {