summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2026-10-06 12:03:59 +0200
committerJohannes Berg <johannes.berg@intel.com>2026-10-09 16:12:45 +0200
commit298618f28bd3d1da677828354b504c12e2f375e4 (patch)
tree61cbe3da38525dc90a82f2cfc1bbd0565f4b63eb /include
parent81a6e0248d8362c69636f312ae78708cad543e93 (diff)
downloadlinux-next-298618f28bd3d1da677828354b504c12e2f375e4.tar.gz
linux-next-298618f28bd3d1da677828354b504c12e2f375e4.zip
wifi: cfg80211: reg: protect regdb pointer with RCU
reg_query_regdb_wmm() is only used by iwlwifi, but even when it was introduced was already broken, as it reads the global db without any locking (drivers can't really guarantee any). Certainly iwlwifi doesn't since it calls it for FW messages. Therefore, it can race against regdb updates. The function uses a local pointer, but doesn't help. Use RCU to protect the regdb pointer to fix that, and update the documentation to mention this (and do some cleanups). Fixes: 19d3577e35e0 ("cfg80211: Add API to allow querying regdb for wmm_rule") Link: https://patch.msgid.link/20261006120655.7c261d237cae.If21cf0af3b0d7e8c62c45ece5dc654b30c9d7757@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/net/cfg80211.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 725dc8053727..a3fb7dd743c8 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -8236,20 +8236,20 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
*/
/**
- * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
- * Regulatory self-managed driver can use it to proactively
- *
+ * reg_query_regdb_wmm - Query internal regulatory db for WMM rules
* @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
* @freq: the frequency (in MHz) to be queried.
- * @rule: pointer to store the wmm rule from the regulatory db.
+ * @rule: pointer to store the WMM rule from the regulatory db.
*
- * Self-managed wireless drivers can use this function to query
+ * Self-managed wireless drivers can use this function to query
* the internal regulatory database to check whether the given
- * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
+ * ISO/IEC 3166 alpha2 country and freq have WMM rule limitations.
*
* Drivers should check the return value, its possible you can get
* an -ENODATA.
*
+ * This uses RCU internally so can be called in just about any context.
+ *
* Return: 0 on success. -ENODATA.
*/
int reg_query_regdb_wmm(char *alpha2, int freq,