diff options
-rw-r--r-- | net/wireless/reg.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 3332d5bce317..7b1a89b20ebf 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -1744,6 +1744,8 @@ static void restore_regulatory_settings(bool reset_user) | |||
1744 | { | 1744 | { |
1745 | char alpha2[2]; | 1745 | char alpha2[2]; |
1746 | struct reg_beacon *reg_beacon, *btmp; | 1746 | struct reg_beacon *reg_beacon, *btmp; |
1747 | struct regulatory_request *reg_request, *tmp; | ||
1748 | LIST_HEAD(tmp_reg_req_list); | ||
1747 | 1749 | ||
1748 | mutex_lock(&cfg80211_mutex); | 1750 | mutex_lock(&cfg80211_mutex); |
1749 | mutex_lock(®_mutex); | 1751 | mutex_lock(®_mutex); |
@@ -1751,6 +1753,25 @@ static void restore_regulatory_settings(bool reset_user) | |||
1751 | reset_regdomains(); | 1753 | reset_regdomains(); |
1752 | restore_alpha2(alpha2, reset_user); | 1754 | restore_alpha2(alpha2, reset_user); |
1753 | 1755 | ||
1756 | /* | ||
1757 | * If there's any pending requests we simply | ||
1758 | * stash them to a temporary pending queue and | ||
1759 | * add then after we've restored regulatory | ||
1760 | * settings. | ||
1761 | */ | ||
1762 | spin_lock(®_requests_lock); | ||
1763 | if (!list_empty(®_requests_list)) { | ||
1764 | list_for_each_entry_safe(reg_request, tmp, | ||
1765 | ®_requests_list, list) { | ||
1766 | if (reg_request->initiator != | ||
1767 | NL80211_REGDOM_SET_BY_USER) | ||
1768 | continue; | ||
1769 | list_del(®_request->list); | ||
1770 | list_add_tail(®_request->list, &tmp_reg_req_list); | ||
1771 | } | ||
1772 | } | ||
1773 | spin_unlock(®_requests_lock); | ||
1774 | |||
1754 | /* Clear beacon hints */ | 1775 | /* Clear beacon hints */ |
1755 | spin_lock_bh(®_pending_beacons_lock); | 1776 | spin_lock_bh(®_pending_beacons_lock); |
1756 | if (!list_empty(®_pending_beacons)) { | 1777 | if (!list_empty(®_pending_beacons)) { |
@@ -1785,8 +1806,31 @@ static void restore_regulatory_settings(bool reset_user) | |||
1785 | */ | 1806 | */ |
1786 | if (is_an_alpha2(alpha2)) | 1807 | if (is_an_alpha2(alpha2)) |
1787 | regulatory_hint_user(user_alpha2); | 1808 | regulatory_hint_user(user_alpha2); |
1788 | } | ||
1789 | 1809 | ||
1810 | if (list_empty(&tmp_reg_req_list)) | ||
1811 | return; | ||
1812 | |||
1813 | mutex_lock(&cfg80211_mutex); | ||
1814 | mutex_lock(®_mutex); | ||
1815 | |||
1816 | spin_lock(®_requests_lock); | ||
1817 | list_for_each_entry_safe(reg_request, tmp, &tmp_reg_req_list, list) { | ||
1818 | REG_DBG_PRINT("Adding request for country %c%c back " | ||
1819 | "into the queue\n", | ||
1820 | reg_request->alpha2[0], | ||
1821 | reg_request->alpha2[1]); | ||
1822 | list_del(®_request->list); | ||
1823 | list_add_tail(®_request->list, ®_requests_list); | ||
1824 | } | ||
1825 | spin_unlock(®_requests_lock); | ||
1826 | |||
1827 | mutex_unlock(®_mutex); | ||
1828 | mutex_unlock(&cfg80211_mutex); | ||
1829 | |||
1830 | REG_DBG_PRINT("Kicking the queue\n"); | ||
1831 | |||
1832 | schedule_work(®_work); | ||
1833 | } | ||
1790 | 1834 | ||
1791 | void regulatory_hint_disconnect(void) | 1835 | void regulatory_hint_disconnect(void) |
1792 | { | 1836 | { |