Skip to content

Commit

Permalink
mac80211: Check pending scan request after having processed mgd work
Browse files Browse the repository at this point in the history
When the queued management work items are processed in
ieee80211_sta_work() an item could be removed. This could change the
anybusy from true to false, so we better check whether we can start a
new scan only after having processed the pending work first.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Jouni Malinen authored and John W. Linville committed Aug 28, 2009
1 parent 15db0b7 commit 5bf6fcc
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions net/mac80211/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2123,25 +2123,9 @@ static void ieee80211_sta_work(struct work_struct *work)
}
}

list_for_each_entry(wk, &ifmgd->work_list, list) {
if (wk->state != IEEE80211_MGD_STATE_IDLE) {
anybusy = true;
break;
}
}

ieee80211_recalc_idle(local);

if (!anybusy) {
mutex_unlock(&ifmgd->mtx);

if (test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request))
ieee80211_queue_delayed_work(&local->hw,
&local->scan_work,
round_jiffies_relative(0));
return;
}

list_for_each_entry_safe(wk, tmp, &ifmgd->work_list, list) {
if (time_is_after_jiffies(wk->timeout)) {
/*
Expand Down Expand Up @@ -2187,6 +2171,18 @@ static void ieee80211_sta_work(struct work_struct *work)
}
}

list_for_each_entry(wk, &ifmgd->work_list, list) {
if (wk->state != IEEE80211_MGD_STATE_IDLE) {
anybusy = true;
break;
}
}
if (!anybusy &&
test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifmgd->request))
ieee80211_queue_delayed_work(&local->hw,
&local->scan_work,
round_jiffies_relative(0));

mutex_unlock(&ifmgd->mtx);

list_for_each_entry_safe(wk, tmp, &free_work, list) {
Expand Down

0 comments on commit 5bf6fcc

Please sign in to comment.