aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/nl80211.c5
-rw-r--r--net/wireless/reg.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 66e0fb6a6420..632504060789 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2570,6 +2570,8 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
2570 return -EINVAL; 2570 return -EINVAL;
2571 } 2571 }
2572 2572
2573 mutex_lock(&cfg80211_mutex);
2574
2573 if (!reg_is_valid_request(alpha2)) { 2575 if (!reg_is_valid_request(alpha2)) {
2574 r = -EINVAL; 2576 r = -EINVAL;
2575 goto bad_reg; 2577 goto bad_reg;
@@ -2607,13 +2609,14 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
2607 2609
2608 BUG_ON(rule_idx != num_rules); 2610 BUG_ON(rule_idx != num_rules);
2609 2611
2610 mutex_lock(&cfg80211_mutex);
2611 r = set_regdom(rd); 2612 r = set_regdom(rd);
2613
2612 mutex_unlock(&cfg80211_mutex); 2614 mutex_unlock(&cfg80211_mutex);
2613 2615
2614 return r; 2616 return r;
2615 2617
2616 bad_reg: 2618 bad_reg:
2619 mutex_unlock(&cfg80211_mutex);
2617 kfree(rd); 2620 kfree(rd);
2618 return r; 2621 return r;
2619} 2622}
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 48db569d4c6b..8d176a8010ba 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -382,6 +382,8 @@ static int call_crda(const char *alpha2)
382/* Used by nl80211 before kmalloc'ing our regulatory domain */ 382/* Used by nl80211 before kmalloc'ing our regulatory domain */
383bool reg_is_valid_request(const char *alpha2) 383bool reg_is_valid_request(const char *alpha2)
384{ 384{
385 assert_cfg80211_lock();
386
385 if (!last_request) 387 if (!last_request)
386 return false; 388 return false;
387 389