Commit a26787aa authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: take wiphy lock for MAC addr change

We want to ensure everything holds the wiphy lock,
so also extend that to the MAC change callback.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 332e68bc
...@@ -251,9 +251,9 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata ...@@ -251,9 +251,9 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
return ret; return ret;
} }
static int ieee80211_change_mac(struct net_device *dev, void *addr) static int _ieee80211_change_mac(struct ieee80211_sub_if_data *sdata,
void *addr)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sockaddr *sa = addr; struct sockaddr *sa = addr;
bool check_dup = true; bool check_dup = true;
...@@ -278,7 +278,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) ...@@ -278,7 +278,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
if (live) if (live)
drv_remove_interface(local, sdata); drv_remove_interface(local, sdata);
ret = eth_mac_addr(dev, sa); ret = eth_mac_addr(sdata->dev, sa);
if (ret == 0) { if (ret == 0) {
memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN);
...@@ -294,6 +294,19 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) ...@@ -294,6 +294,19 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
return ret; return ret;
} }
static int ieee80211_change_mac(struct net_device *dev, void *addr)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
int ret;
wiphy_lock(local->hw.wiphy);
ret = _ieee80211_change_mac(sdata, addr);
wiphy_unlock(local->hw.wiphy);
return ret;
}
static inline int identical_mac_addr_allowed(int type1, int type2) static inline int identical_mac_addr_allowed(int type1, int type2)
{ {
return type1 == NL80211_IFTYPE_MONITOR || return type1 == NL80211_IFTYPE_MONITOR ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment