wlan: Make sure that MAC address generated from serial number is unique
There is a remote possibility that a MAC address generated from the
serial number can coincide with the configured MAC address. This
results in wcnss crash due to 2 interfaces having the same MAC address.
Check if the generated MAC address is same as the configured MAC
address. And if so, change it to a different value.
Change-Id: I24f1fcfe216fa9d6bd785889502b284d7b13058b
CRs-Fixed: 2106135
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index d57ac57..2e4b386 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -11641,6 +11641,11 @@
pHddCtx->cfg_ini->intfMacAddr[i].bytes[4] = (serialno >> 8) & 0xFF;
pHddCtx->cfg_ini->intfMacAddr[i].bytes[5] = serialno & 0xFF;
+ if (0 == memcmp(&pHddCtx->cfg_ini->intfMacAddr[i].bytes[0],
+ &mac_addr.bytes[0], VOS_MAC_ADDR_SIZE))
+ pHddCtx->cfg_ini->intfMacAddr[i].bytes[5] +=
+ VOS_MAX_CONCURRENCY_PERSONA;
+
serialno++;
hddLog(VOS_TRACE_LEVEL_ERROR,
"%s: Derived Mac Addr: "