diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 8b03901fbb72..f35c0e5cec40 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -680,6 +680,12 @@ static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) qdf_mem_copy(&mac_addr, psta_mac_addr->sa_data, sizeof(mac_addr)); + if (hdd_get_adapter_by_macaddr(hdd_ctx, mac_addr.bytes)) { + hdd_err("adapter exist with same mac address " MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(mac_addr.bytes)); + return -EINVAL; + } + if (qdf_is_macaddr_zero(&mac_addr)) { hdd_err("MAC is all zero"); return -EINVAL; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 213d21da8141..bf71ab4b1120 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3260,6 +3260,12 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr) qdf_mem_copy(&mac_addr, psta_mac_addr->sa_data, sizeof(mac_addr)); + if (hdd_get_adapter_by_macaddr(hdd_ctx, mac_addr.bytes)) { + hdd_err("adapter exist with same mac address " MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(mac_addr.bytes)); + return -EINVAL; + } + if (qdf_is_macaddr_zero(&mac_addr)) { hdd_err("MAC is all zero"); return -EINVAL;