wifi: cfg80211: allow reg update by driver even if wiphy->regd is set
authorRaj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Fri, 21 Apr 2023 06:13:12 +0000 (11:43 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 13 Sep 2023 10:34:01 +0000 (12:34 +0200)
commit13ba6794d29ee273c26f26b6c7892797ac9957ae
tree90032f67448c2481684a98ddc866c948f6830916
parent6bc5ddb2fd0653a3e66a8e41fa4c20eced13e4d8
wifi: cfg80211: allow reg update by driver even if wiphy->regd is set

Currently regulatory update by driver is not allowed when the
wiphy->regd is already set and drivers_request->intersect is false.

During wiphy registration, some drivers (ath10k does this currently)
first register the world regulatory to cfg80211 using
wiphy_apply_custom_regulatory(). The driver then obtain the current
operating country and tries to update the correct regulatory to
cfg80211 using regulatory_hint().

But at this point, wiphy->regd is already set to world regulatory.
Also, since this is the first request from driver after the world
regulatory is set this will result in drivers_request->intersect
set to false. In this condition the driver request regulatory is not
allowed to update to cfg80211 in reg_set_rd_driver(). This restricts
the device operation to the world regulatory.

This driver request to update the regulatory with current operating
country is valid and should be updated to cfg80211. Hence allow
regulatory update by driver even if the wiphy->regd is already set
and driver_request->intersect is false.

Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230421061312.13722-1-quic_rajkbhag@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/reg.c