cfg80211 does not apply user or country element hints to self-managed wiphys. However, once such a hint has been made, reg_get_regdomain() returns the global regd instead of the self-managed wiphy's regd. Callers of freq_reg_info(), such as mac80211's ieee80211_regulatory_limit_wmm_params(), will therefore use the wrong rule and may apply incorrect restrictions. Always have reg_get_regdomain() return the wiphy's regd when it is self-managed. This makes the behaviour after a hint consistent with the behaviour before one, where reg_get_regdomain() returns the wiphy's own regd. Signed-off-by: Lewis O'Flynn --- net/wireless/reg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 50f50e768..5460b3117 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1147,11 +1147,13 @@ static const struct ieee80211_regdomain *reg_get_regdomain(struct wiphy *wiphy) /* * Follow the driver's regulatory domain, if present, unless a country - * IE has been processed or a user wants to help compliance further + * IE has been processed or a user wants to help compliance further. + * Self-managed wiphys always use their own regulatory domain. */ - if (lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && - lr->initiator != NL80211_REGDOM_SET_BY_USER && - wiphy->regd) + if (wiphy->regd && + ((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) || + (lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && + lr->initiator != NL80211_REGDOM_SET_BY_USER))) return get_wiphy_regdom(wiphy); return get_cfg80211_regdom(); -- 2.34.1