sctp: Fix regression introduced by new sctp_connectx api
[safe/jmp/linux-2.6] / net / mac80211 / scan.c
index 4573100..71e10ca 100644 (file)
@@ -90,8 +90,8 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
                bss->dtim_period = tim_ie->dtim_period;
        }
 
-       /* set default value for buggy APs */
-       if (!elems->tim || bss->dtim_period == 0)
+       /* set default value for buggy AP/no TIM element */
+       if (bss->dtim_period == 0)
                bss->dtim_period = 1;
 
        bss->supp_rates_len = 0;
@@ -277,9 +277,10 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
        if (test_bit(SCAN_HW_SCANNING, &local->scanning))
                ieee80211_restore_scan_ies(local);
 
-       if (local->scan_req != &local->int_scan_req)
+       if (local->scan_req != local->int_scan_req)
                cfg80211_scan_done(local->scan_req, aborted);
        local->scan_req = NULL;
+       local->scan_sdata = NULL;
 
        was_hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
        local->scanning = 0;
@@ -292,13 +293,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
        if (was_hw_scan)
                goto done;
 
-       spin_lock_bh(&local->filter_lock);
-       local->filter_flags &= ~FIF_BCN_PRBRESP_PROMISC;
-       drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC,
-                            &local->filter_flags,
-                            local->mc_count,
-                            local->mc_list);
-       spin_unlock_bh(&local->filter_lock);
+       ieee80211_configure_filter(local);
 
        drv_sw_scan_complete(local);
 
@@ -376,17 +371,12 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
        local->next_scan_state = SCAN_DECISION;
        local->scan_channel_idx = 0;
 
-       spin_lock_bh(&local->filter_lock);
-       local->filter_flags |= FIF_BCN_PRBRESP_PROMISC;
-       drv_configure_filter(local, FIF_BCN_PRBRESP_PROMISC,
-                            &local->filter_flags,
-                            local->mc_count,
-                            local->mc_list);
-       spin_unlock_bh(&local->filter_lock);
+       ieee80211_configure_filter(local);
 
        /* TODO: start scan as soon as all nullfunc frames are ACKed */
-       queue_delayed_work(local->hw.workqueue, &local->scan_work,
-                          IEEE80211_CHANNEL_TIME);
+       ieee80211_queue_delayed_work(&local->hw,
+                                    &local->scan_work,
+                                    IEEE80211_CHANNEL_TIME);
 
        return 0;
 }
@@ -422,7 +412,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
        local->scan_req = req;
        local->scan_sdata = sdata;
 
-       if (req != &local->int_scan_req &&
+       if (req != local->int_scan_req &&
            sdata->vif.type == NL80211_IFTYPE_STATION &&
            !list_empty(&ifmgd->work_list)) {
                /* actually wait for the work it's doing to finish/time out */
@@ -671,6 +661,7 @@ void ieee80211_scan_work(struct work_struct *work)
                int rc;
 
                local->scan_req = NULL;
+               local->scan_sdata = NULL;
 
                rc = __ieee80211_start_scan(sdata, req);
                mutex_unlock(&local->scan_mtx);
@@ -715,8 +706,7 @@ void ieee80211_scan_work(struct work_struct *work)
                }
        } while (next_delay == 0);
 
-       queue_delayed_work(local->hw.workqueue, &local->scan_work,
-                          next_delay);
+       ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay);
 }
 
 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
@@ -743,10 +733,10 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
        if (local->scan_req)
                goto unlock;
 
-       memcpy(local->int_scan_req.ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
-       local->int_scan_req.ssids[0].ssid_len = ssid_len;
+       memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
+       local->int_scan_req->ssids[0].ssid_len = ssid_len;
 
-       ret = __ieee80211_start_scan(sdata, &sdata->local->int_scan_req);
+       ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
  unlock:
        mutex_unlock(&local->scan_mtx);
        return ret;
@@ -754,7 +744,7 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
 
 void ieee80211_scan_cancel(struct ieee80211_local *local)
 {
-       bool swscan;
+       bool abortscan;
 
        cancel_delayed_work_sync(&local->scan_work);
 
@@ -763,9 +753,10 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
         * queued -- mostly at suspend under RTNL.
         */
        mutex_lock(&local->scan_mtx);
-       swscan = test_bit(SCAN_SW_SCANNING, &local->scanning);
+       abortscan = test_bit(SCAN_SW_SCANNING, &local->scanning) ||
+                   (!local->scanning && local->scan_req);
        mutex_unlock(&local->scan_mtx);
 
-       if (swscan)
+       if (abortscan)
                ieee80211_scan_completed(&local->hw, true);
 }