Skip to content

Commit a9da90e

Browse files
committed
wifi: mac80211: reject address change while connecting
While connecting, the MAC address can already no longer be changed. The change is already rejected if netif_carrier_ok(), but of course that's not true yet while connecting. Check for auth_data or assoc_data, so the MAC address cannot be changed. Also more comprehensively check that there are no stations on the interface being changed - if any peer station is added it will know about our address already, so we cannot change it. Cc: stable@vger.kernel.org Fixes: 3c06e91 ("wifi: mac80211: Support POWERED_ADDR_CHANGE feature") Link: https://patch.msgid.link/20251105154119.f9f6c1df81bb.I9bb3760ede650fb96588be0d09a5a7bdec21b217@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent c2c2ccf commit a9da90e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

net/mac80211/iface.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
223223
if (netif_carrier_ok(sdata->dev))
224224
return -EBUSY;
225225

226+
/* if any stations are set known (so they know this vif too), reject */
227+
if (sta_info_get_by_idx(sdata, 0))
228+
return -EBUSY;
229+
226230
/* First check no ROC work is happening on this iface */
227231
list_for_each_entry(roc, &local->roc_list, list) {
228232
if (roc->sdata != sdata)
@@ -242,12 +246,16 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
242246
ret = -EBUSY;
243247
}
244248

249+
/*
250+
* More interface types could be added here but changing the
251+
* address while powered makes the most sense in client modes.
252+
*/
245253
switch (sdata->vif.type) {
246254
case NL80211_IFTYPE_STATION:
247255
case NL80211_IFTYPE_P2P_CLIENT:
248-
/* More interface types could be added here but changing the
249-
* address while powered makes the most sense in client modes.
250-
*/
256+
/* refuse while connecting */
257+
if (sdata->u.mgd.auth_data || sdata->u.mgd.assoc_data)
258+
return -EBUSY;
251259
break;
252260
default:
253261
ret = -EOPNOTSUPP;

0 commit comments

Comments
 (0)