mac80211: abort scan_work immediately when the device goes down
authorRajkumar Manoharan <rmanoharan@atheros.com>
Sat, 14 May 2011 04:13:28 +0000 (09:43 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 16 May 2011 18:25:29 +0000 (14:25 -0400)
As long as no delay is required b/w channel change, scan work
is proceeding without scheduling a new work. In such case, we
can not abort scan work when the card was unplugged. This patch
completes the scanning immediately whenever the device goes down.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/iface.c
net/mac80211/scan.c

index 0d00ac93d95823b8e1559d0f0310d8ff93d3a301..dee30aea9ab31eba7021812894c35d495e28ab71 100644 (file)
@@ -384,11 +384,11 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
        int i;
        enum nl80211_channel_type orig_ct;
 
+       clear_bit(SDATA_STATE_RUNNING, &sdata->state);
+
        if (local->scan_sdata == sdata)
                ieee80211_scan_cancel(local);
 
-       clear_bit(SDATA_STATE_RUNNING, &sdata->state);
-
        /*
         * Stop TX on this interface first.
         */
index d20046b5d8f4953bb4ae4007e927ccee1505985a..27af6723cb5e5496efc606010bf04541806da43e 100644 (file)
@@ -719,6 +719,11 @@ void ieee80211_scan_work(struct work_struct *work)
         * without scheduling a new work
         */
        do {
+               if (!ieee80211_sdata_running(sdata)) {
+                       aborted = true;
+                       goto out_complete;
+               }
+
                switch (local->next_scan_state) {
                case SCAN_DECISION:
                        /* if no more bands/channels left, complete scan */