diff options
| author | Ashish Kumar Dhanotiya <adhanoti@codeaurora.org> | 2018-04-19 16:03:15 +0530 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-05-02 07:55:40 -0700 |
| commit | fa9c464cdf188fa8c6691e1a9f5076b671633edf (patch) | |
| tree | b055789aa22f36a8a79dd1f6ae8f1f1a6b4e607a | |
| parent | 08e7ec47f12c64fe5e325bc15c5e4fe9664e028e (diff) | |
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
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.c | 6 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index b7d3a5b35526..f5d23d83b4f7 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -573,6 +573,12 @@ static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) qdf_mem_copy(&mac_addr, psta_mac_addr->sa_data, QDF_MAC_ADDR_SIZE); + 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 e07e521a4299..c857c9c26a0a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2757,6 +2757,12 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr) qdf_mem_copy(&mac_addr, psta_mac_addr->sa_data, QDF_MAC_ADDR_SIZE); + 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; |
