Просмотр исходного кода

qcacld-3.0: Fix country IE validation logic

Update the logic to fix a potential memory leak when there is an
invalid country IE. Also update the logic to not reject the connection
in the case of an invalid country IE, since this is a bad user
experience.

Change-Id: I6a2b50a483e65554a6622dccbb0bac61331fc4fb
CRs-fixed: 2883385
Lincoln Tran 4 лет назад
Родитель
Сommit
76c8aae668
1 измененных файлов с 12 добавлено и 5 удалено
  1. 12 5
      core/sme/src/csr/csr_api_roam.c

+ 12 - 5
core/sme/src/csr/csr_api_roam.c

@@ -13672,6 +13672,15 @@ rel_vdev_ref:
 	return status;
 }
 
+/*
+ * csr_iterate_triplets() - Iterate the country IE to validate it
+ * @country_ie: country IE to iterate through
+ *
+ * This function always returns success because connection should not be failed
+ * in the case of missing elements in the country IE
+ *
+ * Return: QDF_STATUS
+ */
 static QDF_STATUS csr_iterate_triplets(tDot11fIECountry country_ie)
 {
 	u_int8_t i;
@@ -13689,8 +13698,8 @@ static QDF_STATUS csr_iterate_triplets(tDot11fIECountry country_ie)
 				return QDF_STATUS_SUCCESS;
 		}
 	}
-	sme_err_rl("No operating class triplet followed by channel range triplet");
-	return QDF_STATUS_E_FAILURE;
+	sme_debug("No operating class triplet followed by channel range triplet");
+	return QDF_STATUS_SUCCESS;
 }
 
 /**
@@ -14111,7 +14120,7 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 
 		if (wlan_reg_is_6ghz_chan_freq(pBssDescription->chan_freq)) {
 			if (!pIes->Country.present)
-				sme_debug("Channel is 6G but not country IE present");
+				sme_debug("Channel is 6G but country IE not present");
 			wlan_reg_read_current_country(mac->psoc,
 						      programmed_country);
 			if (!qdf_mem_cmp(pIes->Country.country,
@@ -14119,8 +14128,6 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 					 REG_ALPHA2_LEN + 1))
 				sme_debug("Country IE does not match country stored in regulatory");
 			status = csr_iterate_triplets(pIes->Country);
-			if (QDF_IS_STATUS_ERROR(status))
-				return status;
 		}
 
 		if (wlan_reg_is_6ghz_chan_freq(pBssDescription->chan_freq)) {