cfg80211: off by one in nl80211_trigger_scan()
[firefly-linux-kernel-4.4.55.git] / net / wireless / reg.c
index 58d69959ab28c033741a61ef836e88a16be11791..02751dbc5a97fab55abdefb9936dfc24c2d4ef22 100644 (file)
@@ -672,11 +672,9 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
        for (i = 0; i < regd->n_reg_rules; i++) {
                const struct ieee80211_reg_rule *rr;
                const struct ieee80211_freq_range *fr = NULL;
-               const struct ieee80211_power_rule *pr = NULL;
 
                rr = &regd->reg_rules[i];
                fr = &rr->freq_range;
-               pr = &rr->power_rule;
 
                /*
                 * We only need to know if one frequency rule was
@@ -905,7 +903,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
            initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
            !is_world_regdom(last_request->alpha2)) {
                REG_DBG_PRINT("Ignoring regulatory request %s "
-                             "since the driver requires its own regulaotry "
+                             "since the driver requires its own regulatory "
                              "domain to be set first",
                              reg_initiator_name(initiator));
                return true;
@@ -1127,12 +1125,13 @@ void wiphy_update_regulatory(struct wiphy *wiphy,
        enum ieee80211_band band;
 
        if (ignore_reg_update(wiphy, initiator))
-               goto out;
+               return;
+
        for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                if (wiphy->bands[band])
                        handle_band(wiphy, band, initiator);
        }
-out:
+
        reg_process_beacons(wiphy);
        reg_process_ht_flags(wiphy);
        if (wiphy->reg_notifier)
@@ -1455,7 +1454,8 @@ static void reg_process_hint(struct regulatory_request *reg_request)
         * We only time out user hints, given that they should be the only
         * source of bogus requests.
         */
-       if (reg_request->initiator == NL80211_REGDOM_SET_BY_USER)
+       if (r != -EALREADY &&
+           reg_request->initiator == NL80211_REGDOM_SET_BY_USER)
                schedule_delayed_work(&reg_timeout, msecs_to_jiffies(3142));
 }