Browse Source

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 years ago
parent
commit
0148519463
1 changed files with 15 additions and 1 deletions
  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: