Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit be31c9b

Browse files
jmberg-intelgregkh
authored andcommitted
wifi: mac80211: take wiphy lock for MAC addr change
[ Upstream commit a26787a ] We want to ensure everything holds the wiphy lock, so also extend that to the MAC change callback. Signed-off-by: Johannes Berg <[email protected]> Stable-dep-of: 74a7c93 ("wifi: mac80211: fix change_address deadlock during unregister") Signed-off-by: Sasha Levin <[email protected]>
1 parent 77100f2 commit be31c9b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

net/mac80211/iface.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
251251
return ret;
252252
}
253253

254-
static int ieee80211_change_mac(struct net_device *dev, void *addr)
254+
static int _ieee80211_change_mac(struct ieee80211_sub_if_data *sdata,
255+
void *addr)
255256
{
256-
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
257257
struct ieee80211_local *local = sdata->local;
258258
struct sockaddr *sa = addr;
259259
bool check_dup = true;
@@ -278,7 +278,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
278278

279279
if (live)
280280
drv_remove_interface(local, sdata);
281-
ret = eth_mac_addr(dev, sa);
281+
ret = eth_mac_addr(sdata->dev, sa);
282282

283283
if (ret == 0) {
284284
memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN);
@@ -294,6 +294,19 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
294294
return ret;
295295
}
296296

297+
static int ieee80211_change_mac(struct net_device *dev, void *addr)
298+
{
299+
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
300+
struct ieee80211_local *local = sdata->local;
301+
int ret;
302+
303+
wiphy_lock(local->hw.wiphy);
304+
ret = _ieee80211_change_mac(sdata, addr);
305+
wiphy_unlock(local->hw.wiphy);
306+
307+
return ret;
308+
}
309+
297310
static inline int identical_mac_addr_allowed(int type1, int type2)
298311
{
299312
return type1 == NL80211_IFTYPE_MONITOR ||

0 commit comments

Comments
 (0)