Browse Source

qcacld-3.0: Avoid duplicate MAC configuration

Currently if the MAC is changed dynamically for any interface,
driver is allowing to configure a MAC which is already in use by
some other interface and it will allow different interfaces to
come up on same MAC address.

To address this issue add a check to configfure only different
MAC address.

Change-Id: Iece3bb063be30d5d983f4bec710d6d16b22bd2f9
CRs-Fixed: 2227656
Ashish Kumar Dhanotiya 7 years ago
parent
commit
f974f3355f
2 changed files with 12 additions and 0 deletions
  1. 6 0
      core/hdd/src/wlan_hdd_hostapd.c
  2. 6 0
      core/hdd/src/wlan_hdd_main.c

+ 6 - 0
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;

+ 6 - 0
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;