소스 검색

qcacld-3.0: Check for the duplicate MAC during open adapter

Currently for STA mode in open adapter, locally administered
bit is getting reset, there is a possibility that after
resetting this locally administered bit this new MAC matches
to an existing MAC address which may result in multiple interfaces
to be up with same MAC address.

To avoid this issue, add a check for duplicate MAC address after
resetting locally administered bit.

Change-Id: I3ff8091df2c422bd89944ca39849c9961941e8c3
CRs-fixed: 2370349
Ashish Kumar Dhanotiya 6 년 전
부모
커밋
0148519463
1개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 15 1
      core/hdd/src/wlan_hdd_main.c

+ 15 - 1
core/hdd/src/wlan_hdd_main.c

@@ -5045,8 +5045,22 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
 
 	switch (session_type) {
 	case QDF_STA_MODE:
-		if (!hdd_ctx->config->mac_provision)
+		if (!hdd_ctx->config->mac_provision) {
 			hdd_reset_locally_admin_bit(hdd_ctx, macAddr);
+			/*
+			 * After resetting locally administered bit
+			 * again check if the new mac address is already
+			 * exists.
+			 */
+			status = hdd_check_for_existing_macaddr(hdd_ctx,
+								macAddr);
+			if (QDF_STATUS_E_FAILURE == status) {
+				hdd_err("Duplicate MAC addr: " MAC_ADDRESS_STR
+					" already exists",
+					MAC_ADDR_ARRAY(macAddr));
+				return NULL;
+			}
+		}
 
 	/* fall through */
 	case QDF_P2P_CLIENT_MODE: