浏览代码

qcacld-3.0: Fix the no.of supported rate check

Supported rates and extended supported rates together checked
against max supported rates that is failing the processing.
Fix the value to check against the max rates.

Change-Id: I3a20c5ac496fbedda5b105d95a1af9a168a53864
CRs-Fixed: 2895899
Kiran Kumar Lokere 4 年之前
父节点
当前提交
516228172b

+ 1 - 1
core/mac/inc/sir_mac_prot_def.h

@@ -531,7 +531,7 @@ typedef struct sSirMacTim {
 /* The parser assume this to be at least 12 */
 typedef struct sSirMacRateSet {
 	uint8_t numRates;
-	uint8_t rate[WLAN_SUPPORTED_RATES_IE_MAX_LEN];
+	uint8_t rate[SIR_MAC_MAX_NUMBER_OF_RATES];
 } qdf_packed tSirMacRateSet;
 
 /** struct merged_mac_rate_set - merged mac rate set

+ 18 - 17
core/mac/src/pe/lim/lim_assoc_utils.c

@@ -202,7 +202,8 @@ lim_check_rx_basic_rates(struct mac_context *mac, tSirMacRateSet rxRateSet,
 
 	/* Extract BSS basic rateset from operational rateset */
 	for (i = 0, j = 0;
-	     ((i < pRateSet->numRates) && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); i++) {
+	     ((i < pRateSet->numRates) && (i < SIR_MAC_MAX_NUMBER_OF_RATES));
+	     i++) {
 		if ((pRateSet->rate[i] & 0x80) == 0x80) {
 			/* msb is set, so this is a basic rate */
 			basicRate.rate[j++] = pRateSet->rate[i];
@@ -216,8 +217,8 @@ lim_check_rx_basic_rates(struct mac_context *mac, tSirMacRateSet rxRateSet,
 	for (k = 0; k < j; k++) {
 		match = 0;
 		for (i = 0;
-		     ((i < rxRateSet.numRates)
-		      && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); i++) {
+		     ((i < rxRateSet.numRates) &&
+		      (i < SIR_MAC_MAX_NUMBER_OF_RATES)); i++) {
 			if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k])
 				match = 1;
 		}
@@ -1480,7 +1481,7 @@ QDF_STATUS lim_populate_own_rate_set(struct mac_context *mac_ctx,
 		is_arate = 0;
 
 		for (j = 0; (j < temp_rate_set.numRates) &&
-			 (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) {
+			 (j < SIR_MAC_MAX_NUMBER_OF_RATES); j++) {
 			if ((uint32_t) (temp_rate_set.rate[j] & 0x7f) <
 					val) {
 				val = temp_rate_set.rate[j] & 0x7f;
@@ -1607,13 +1608,13 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac,
 	tSchBeaconStruct *pBeaconStruct = NULL;
 
 	/* copy operational rate set from pe_session */
-	if (pe_session->rateSet.numRates <= WLAN_SUPPORTED_RATES_IE_MAX_LEN) {
+	if (pe_session->rateSet.numRates <= SIR_MAC_MAX_NUMBER_OF_RATES) {
 		qdf_mem_copy((uint8_t *) tempRateSet.rate,
 			     (uint8_t *) (pe_session->rateSet.rate),
 			     pe_session->rateSet.numRates);
 		tempRateSet.numRates = pe_session->rateSet.numRates;
 	} else {
-		pe_err("more than WLAN_SUPPORTED_RATES_IE_MAX_LEN rates");
+		pe_err("more than SIR_MAC_MAX_NUMBER_OF_RATES rates");
 		return QDF_STATUS_E_FAILURE;
 	}
 	if ((pe_session->dot11mode == MLME_DOT11_MODE_11G) ||
@@ -1622,7 +1623,7 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac,
 		(pe_session->dot11mode == MLME_DOT11_MODE_11N) ||
 		(pe_session->dot11mode == MLME_DOT11_MODE_11AX)) {
 		if (pe_session->extRateSet.numRates <=
-		    WLAN_SUPPORTED_RATES_IE_MAX_LEN) {
+		    SIR_MAC_MAX_NUMBER_OF_RATES) {
 			qdf_mem_copy((uint8_t *) tempRateSet2.rate,
 				     (uint8_t *) (pe_session->extRateSet.
 						  rate),
@@ -1630,14 +1631,14 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac,
 			tempRateSet2.numRates =
 				pe_session->extRateSet.numRates;
 		} else {
-			pe_err("pe_session->extRateSet.numRates more than WLAN_SUPPORTED_RATES_IE_MAX_LEN rates");
+			pe_err("numRates more than SIR_MAC_MAX_NUM_OF_RATES");
 			return QDF_STATUS_E_FAILURE;
 		}
 	} else
 		tempRateSet2.numRates = 0;
 	if ((tempRateSet.numRates + tempRateSet2.numRates) >
-	    WLAN_SUPPORTED_RATES_IE_MAX_LEN) {
-		pe_err("more than 12 rates in CFG");
+	    SIR_MAC_MAX_NUMBER_OF_RATES) {
+		pe_err("rates in CFG are more than SIR_MAC_MAX_NUM_OF_RATES");
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -1657,7 +1658,7 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac,
 		val = 0xff;
 		isArate = 0;
 		for (j = 0; (j < tempRateSet.numRates) &&
-		     (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) {
+		     (j < SIR_MAC_MAX_NUMBER_OF_RATES); j++) {
 			if ((uint32_t)(tempRateSet.rate[j] & 0x7f) <
 					val) {
 				val = tempRateSet.rate[j] & 0x7f;
@@ -1887,7 +1888,7 @@ QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx,
 	 * unicity of the rates so there cannot be more than 12
 	 */
 	for (i = 0; (i < oper_rate_set->numRates &&
-			 i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++)
+			 i < SIR_MAC_MAX_NUMBER_OF_RATES); i++)
 		temp_rate_set.rate[i] = oper_rate_set->rate[i];
 
 	temp_rate_set.numRates = oper_rate_set->numRates;
@@ -1902,7 +1903,7 @@ QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx,
 		int tail = temp_rate_set.numRates;
 
 		for (i = 0; (i < ext_rate_set->numRates &&
-				i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) {
+				i < SIR_MAC_MAX_NUMBER_OF_RATES); i++) {
 			found = 0;
 			for (j = 0; j < (uint32_t) tail; j++) {
 				if ((temp_rate_set.rate[j] & 0x7F) ==
@@ -1922,8 +1923,8 @@ QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx,
 	} else if (ext_rate_set->numRates &&
 		 ((temp_rate_set.numRates + ext_rate_set->numRates) <= 12)) {
 		for (j = 0; ((j < ext_rate_set->numRates) &&
-				 (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN) &&
-				 ((i + j) < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); j++)
+				 (j < SIR_MAC_MAX_NUMBER_OF_RATES) &&
+				 ((i + j) < SIR_MAC_MAX_NUMBER_OF_RATES)); j++)
 			temp_rate_set.rate[i + j] = ext_rate_set->rate[j];
 
 		temp_rate_set.numRates += ext_rate_set->numRates;
@@ -1934,9 +1935,9 @@ QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx,
 	rates = &sta_ds->supportedRates;
 	qdf_mem_zero(rates, sizeof(*rates));
 	for (i = 0; (i < temp_rate_set2.numRates &&
-			 i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) {
+			 i < SIR_MAC_MAX_NUMBER_OF_RATES); i++) {
 		for (j = 0; (j < temp_rate_set.numRates &&
-				 j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) {
+				 j < SIR_MAC_MAX_NUMBER_OF_RATES); j++) {
 			if ((temp_rate_set2.rate[i] & 0x7F) !=
 				(temp_rate_set.rate[j] & 0x7F))
 				continue;

+ 4 - 4
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -375,14 +375,14 @@ static bool lim_chk_rates(struct mac_context *mac_ctx, tpSirMacMgmtHdr hdr,
 	 */
 	basic_rates.numRates = 0;
 
-	for (i = 0; i < assoc_req->supportedRates.numRates
-			&& (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) {
+	for (i = 0; i < assoc_req->supportedRates.numRates &&
+	     (i < SIR_MAC_MAX_NUMBER_OF_RATES); i++) {
 		basic_rates.rate[i] = assoc_req->supportedRates.rate[i];
 		basic_rates.numRates++;
 	}
 
-	for (j = 0; (j < assoc_req->extendedRates.numRates)
-			&& (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++, j++) {
+	for (j = 0; (j < assoc_req->extendedRates.numRates) &&
+	     (i < SIR_MAC_MAX_NUMBER_OF_RATES); i++, j++) {
 		basic_rates.rate[i] = assoc_req->extendedRates.rate[j];
 		basic_rates.numRates++;
 	}

+ 2 - 2
core/mac/src/pe/lim/lim_process_tdls.c

@@ -2633,10 +2633,10 @@ lim_tdls_populate_matching_rate_set(struct mac_context *mac_ctx,
 	 * Copy received rates in temp_rate_set, the parser has ensured
 	 * unicity of the rates so there cannot be more than 12 .
 	 */
-	if (supp_rates_len > WLAN_SUPPORTED_RATES_IE_MAX_LEN) {
+	if (supp_rates_len > SIR_MAC_MAX_NUMBER_OF_RATES) {
 		pe_warn("Supported rates length: %d more than the Max limit, reset to Max",
 			supp_rates_len);
-		supp_rates_len = WLAN_SUPPORTED_RATES_IE_MAX_LEN;
+		supp_rates_len = SIR_MAC_MAX_NUMBER_OF_RATES;
 	}
 
 	for (i = 0; i < supp_rates_len; i++)

+ 2 - 2
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -825,7 +825,7 @@ populate_dot11f_ext_supp_rates(struct mac_context *mac, uint8_t nChannelNum,
 {
 	QDF_STATUS nsir_status;
 	qdf_size_t nRates = 0;
-	uint8_t rates[WLAN_SUPPORTED_RATES_IE_MAX_LEN];
+	uint8_t rates[SIR_MAC_MAX_NUMBER_OF_RATES];
 
 	/* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
 	   else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
@@ -844,7 +844,7 @@ populate_dot11f_ext_supp_rates(struct mac_context *mac, uint8_t nChannelNum,
 			pe_err("null pe_session");
 			return QDF_STATUS_E_INVAL;
 		}
-		nRates = WLAN_SUPPORTED_RATES_IE_MAX_LEN;
+		nRates = SIR_MAC_MAX_NUMBER_OF_RATES;
 		nsir_status = mlme_get_ext_opr_rate(pe_session->vdev, rates,
 						    &nRates);
 		if (QDF_IS_STATUS_ERROR(nsir_status)) {

+ 6 - 6
core/sme/src/csr/csr_api_roam.c

@@ -11558,9 +11558,9 @@ static void csr_populate_supported_rates_from_hostapd(tSirMacRateSet *opr_rates,
 		profile->supported_rates.numRates =
 			WLAN_SUPPORTED_RATES_IE_MAX_LEN;
 
-	if (profile->extended_rates.numRates > WLAN_SUPPORTED_RATES_IE_MAX_LEN)
+	if (profile->extended_rates.numRates > SIR_MAC_MAX_NUMBER_OF_RATES)
 		profile->extended_rates.numRates =
-			WLAN_SUPPORTED_RATES_IE_MAX_LEN;
+			SIR_MAC_MAX_NUMBER_OF_RATES;
 
 	if (profile->supported_rates.numRates) {
 		opr_rates->numRates = profile->supported_rates.numRates;
@@ -11745,12 +11745,12 @@ csr_roam_get_bss_start_parms_from_bss_desc(
 	}
 	if (pIes->ExtSuppRates.present) {
 		pParam->extendedRateSet.numRates = pIes->ExtSuppRates.num_rates;
-		if (pIes->ExtSuppRates.num_rates > WLAN_SUPPORTED_RATES_IE_MAX_LEN) {
-			sme_err(
-				"num_rates: %d > max val, resetting",
+		if (pIes->ExtSuppRates.num_rates >
+		    SIR_MAC_MAX_NUMBER_OF_RATES) {
+			sme_err("num_rates: %d > max val, resetting",
 				pIes->ExtSuppRates.num_rates);
 			pIes->ExtSuppRates.num_rates =
-				WLAN_SUPPORTED_RATES_IE_MAX_LEN;
+				SIR_MAC_MAX_NUMBER_OF_RATES;
 		}
 		qdf_mem_copy(pParam->extendedRateSet.rate,
 			     pIes->ExtSuppRates.rates,