cfg80211: Schedule timeout for all CRDA calls
authorIlan peer <ilan.peer@intel.com>
Wed, 4 Mar 2015 05:32:07 +0000 (00:32 -0500)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Mar 2015 08:37:59 +0000 (09:37 +0100)
Timeout was scheduled only in case CRDA was called due to user hints,
but was not scheduled for other cases. This can result in regulatory
hint processing getting stuck in case that there is no CRDA configured.

Change this by scheduling a timeout every time CRDA is called. In
addition, in restore_regulatory_settings() all pending requests are
restored (and not only the user ones).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Acked-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/reg.c

index 4239dd40813716d21c4b4ecbaf8afcb2b88ef9ac..d8671036c264ff287f1f0a8a12e6ecf577c7143d 100644 (file)
@@ -552,6 +552,9 @@ reg_call_crda(struct regulatory_request *request)
 {
        if (call_crda(request->alpha2))
                return REG_REQ_IGNORE;
+
+       queue_delayed_work(system_power_efficient_wq,
+                          &reg_timeout, msecs_to_jiffies(3142));
        return REG_REQ_OK;
 }
 
@@ -1791,8 +1794,7 @@ static void reg_set_request_processed(void)
                need_more_processing = true;
        spin_unlock(&reg_requests_lock);
 
-       if (lr->initiator == NL80211_REGDOM_SET_BY_USER)
-               cancel_delayed_work(&reg_timeout);
+       cancel_delayed_work(&reg_timeout);
 
        if (need_more_processing)
                schedule_work(&reg_work);
@@ -2071,8 +2073,6 @@ static void reg_process_hint(struct regulatory_request *reg_request)
                if (treatment == REG_REQ_IGNORE ||
                    treatment == REG_REQ_ALREADY_SET)
                        return;
-               queue_delayed_work(system_power_efficient_wq,
-                                  &reg_timeout, msecs_to_jiffies(3142));
                return;
        case NL80211_REGDOM_SET_BY_DRIVER:
                if (!wiphy)
@@ -2496,7 +2496,6 @@ static void restore_regulatory_settings(bool reset_user)
        char alpha2[2];
        char world_alpha2[2];
        struct reg_beacon *reg_beacon, *btmp;
-       struct regulatory_request *reg_request, *tmp;
        LIST_HEAD(tmp_reg_req_list);
        struct cfg80211_registered_device *rdev;
 
@@ -2524,11 +2523,7 @@ static void restore_regulatory_settings(bool reset_user)
         * settings.
         */
        spin_lock(&reg_requests_lock);
-       list_for_each_entry_safe(reg_request, tmp, &reg_requests_list, list) {
-               if (reg_request->initiator != NL80211_REGDOM_SET_BY_USER)
-                       continue;
-               list_move_tail(&reg_request->list, &tmp_reg_req_list);
-       }
+       list_splice_tail_init(&reg_requests_list, &tmp_reg_req_list);
        spin_unlock(&reg_requests_lock);
 
        /* Clear beacon hints */