mac80211: check whether scan is in progress before queueing scan_work
[safe/jmp/linux-2.6] / net / mac80211 / work.c
index 1e1ea30..7bd8670 100644 (file)
@@ -919,11 +919,16 @@ static void ieee80211_work_work(struct work_struct *work)
                run_again(local, jiffies + HZ/2);
        }
 
-       if (list_empty(&local->work_list) && local->scan_req)
+       mutex_lock(&local->scan_mtx);
+
+       if (list_empty(&local->work_list) && local->scan_req &&
+           !local->scanning)
                ieee80211_queue_delayed_work(&local->hw,
                                             &local->scan_work,
                                             round_jiffies_relative(0));
 
+       mutex_unlock(&local->scan_mtx);
+
        mutex_unlock(&local->work_mtx);
 
        ieee80211_recalc_idle(local);