aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/reg.c51
1 files changed, 9 insertions, 42 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2d1d183ae6f0..f386981734a0 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1762,6 +1762,10 @@ static bool reg_same_country_ie_hint(struct wiphy *wiphy,
1762 return false; 1762 return false;
1763} 1763}
1764 1764
1765/*
1766 * We hold wdev_lock() here so we cannot hold cfg80211_mutex() and
1767 * therefore cannot iterate over the rdev list here.
1768 */
1765void regulatory_hint_11d(struct wiphy *wiphy, 1769void regulatory_hint_11d(struct wiphy *wiphy,
1766 u8 *country_ie, 1770 u8 *country_ie,
1767 u8 country_ie_len) 1771 u8 country_ie_len)
@@ -1804,51 +1808,14 @@ void regulatory_hint_11d(struct wiphy *wiphy,
1804 * We will run this for *every* beacon processed for the BSSID, so 1808 * We will run this for *every* beacon processed for the BSSID, so
1805 * we optimize an early check to exit out early if we don't have to 1809 * we optimize an early check to exit out early if we don't have to
1806 * do anything 1810 * do anything
1811 *
1812 * We leave conflict resolution to the workqueue, where can hold
1813 * cfg80211_mutex.
1807 */ 1814 */
1808 if (likely(last_request->initiator == 1815 if (likely(last_request->initiator ==
1809 NL80211_REGDOM_SET_BY_COUNTRY_IE && 1816 NL80211_REGDOM_SET_BY_COUNTRY_IE &&
1810 wiphy_idx_valid(last_request->wiphy_idx))) { 1817 wiphy_idx_valid(last_request->wiphy_idx)))
1811 struct cfg80211_registered_device *rdev_last_ie; 1818 goto out;
1812
1813 rdev_last_ie =
1814 cfg80211_rdev_by_wiphy_idx(last_request->wiphy_idx);
1815
1816 /*
1817 * Lets keep this simple -- we trust the first AP
1818 * after we intersect with CRDA
1819 */
1820 if (likely(&rdev_last_ie->wiphy == wiphy)) {
1821 /*
1822 * Ignore IEs coming in on this wiphy with
1823 * the same alpha2 and environment cap
1824 */
1825 if (likely(alpha2_equal(rdev_last_ie->country_ie_alpha2,
1826 alpha2) &&
1827 env == rdev_last_ie->env)) {
1828 goto out;
1829 }
1830 /*
1831 * the wiphy moved on to another BSSID or the AP
1832 * was reconfigured. XXX: We need to deal with the
1833 * case where the user suspends and goes to goes
1834 * to another country, and then gets IEs from an
1835 * AP with different settings
1836 */
1837 goto out;
1838 } else {
1839 /*
1840 * Ignore IEs coming in on two separate wiphys with
1841 * the same alpha2 and environment cap
1842 */
1843 if (likely(alpha2_equal(rdev_last_ie->country_ie_alpha2,
1844 alpha2) &&
1845 env == rdev_last_ie->env)) {
1846 goto out;
1847 }
1848 /* We could potentially intersect though */
1849 goto out;
1850 }
1851 }
1852 1819
1853 rd = country_ie_2_rd(country_ie, country_ie_len, &checksum); 1820 rd = country_ie_2_rd(country_ie, country_ie_len, &checksum);
1854 if (!rd) 1821 if (!rd)