aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/reg.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 290ececd4f11..845e2d326632 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -826,10 +826,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
826 if (WARN_ON(!reg_is_valid_request(rd->alpha2))) 826 if (WARN_ON(!reg_is_valid_request(rd->alpha2)))
827 return -EINVAL; 827 return -EINVAL;
828 828
829 reset_regdomains();
830
831 /* Country IE parsing coming soon */
832
833 if (!is_valid_rd(rd)) { 829 if (!is_valid_rd(rd)) {
834 printk(KERN_ERR "cfg80211: Invalid " 830 printk(KERN_ERR "cfg80211: Invalid "
835 "regulatory domain detected:\n"); 831 "regulatory domain detected:\n");
@@ -837,16 +833,33 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
837 return -EINVAL; 833 return -EINVAL;
838 } 834 }
839 835
840 if (unlikely(last_request->intersect)) { 836 if (!last_request->intersect) {
837 reset_regdomains();
838 cfg80211_regdomain = rd;
839 return 0;
840 }
841
842 /* Intersection requires a bit more work */
843
844 if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) {
845
841 intersected_rd = regdom_intersect(rd, cfg80211_regdomain); 846 intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
842 if (!intersected_rd) 847 if (!intersected_rd)
843 return -EINVAL; 848 return -EINVAL;
849
850 /* We can trash what CRDA provided now */
844 kfree(rd); 851 kfree(rd);
845 rd = intersected_rd; 852 rd = NULL;
853
854 reset_regdomains();
855 cfg80211_regdomain = intersected_rd;
856
857 return 0;
846 } 858 }
847 859
848 /* Tada! */ 860 /* Country IE parsing coming soon */
849 cfg80211_regdomain = rd; 861 reset_regdomains();
862 WARN_ON(1);
850 863
851 return 0; 864 return 0;
852} 865}