wifi: cfg80211: reg: set intersected regd under wiphy mutex

When regulatory request is intersected, the wiphy's regd
is replaced holding only the RTNL, while the non-intersected
case holds the wiphy mutex - we document access to need it.

Current readers that don't hold RTNL also don't get into it,
but it's more consistent and I want to remove the RTNL later.

Also move the similar code in reg_process_hint_driver() to
the same pattern as preparation.

Link: https://patch.msgid.link/20261006120655.a60980246fcb.Id7ac6e91aecb976f1897aa3a211a3eb7c871831e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2026-10-06 12:04:05 +02:00
parent e44b2bf77d
commit 379d1a3471

View File

@ -2865,12 +2865,12 @@ reg_process_hint_driver(struct wiphy *wiphy,
if (IS_ERR(regd))
return REG_REQ_IGNORE;
tmp = get_wiphy_regdom(wiphy);
ASSERT_RTNL();
scoped_guard(wiphy, wiphy) {
tmp = get_wiphy_regdom(wiphy);
rcu_assign_pointer(wiphy->regd, regd);
rcu_free_regdom(tmp);
}
rcu_free_regdom(tmp);
}
@ -3952,9 +3952,11 @@ static int reg_set_rd_driver(const struct ieee80211_regdomain *rd,
* However if a driver requested this specific regulatory
* domain we keep it for its private use
*/
tmp = get_wiphy_regdom(request_wiphy);
rcu_assign_pointer(request_wiphy->regd, rd);
rcu_free_regdom(tmp);
scoped_guard(wiphy, request_wiphy) {
tmp = get_wiphy_regdom(request_wiphy);
rcu_assign_pointer(request_wiphy->regd, rd);
rcu_free_regdom(tmp);
}
rd = NULL;