diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5ae97e72cef2..f2cf71a75b2d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -8197,6 +8197,8 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy, * it wants to follow we respect that unless a country IE has been received * and processed already. * + * Must be called within an RCU read-side critical section. + * * Return: A valid pointer, or, when an error occurs, for example if no rule * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to * check and PTR_ERR() to obtain the numeric return value. The numeric return diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 34642b48ba8a..e82913c9cf82 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -1540,9 +1540,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy, goto nla_put_failure; if (large) { - const struct ieee80211_reg_rule *rule = - freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); + const struct ieee80211_reg_rule *rule; + guard(rcu)(); + rule = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); if (!IS_ERR_OR_NULL(rule) && rule->has_wmm) { if (nl80211_msg_put_wmm_rules(msg, rule)) goto nla_put_failure;