Skip to content

Commit 9b5bd5a

Browse files
greearbjmberg-intel
authored andcommitted
mac80211: stop timers before canceling work items
Re-order the quiesce code so that timers are always stopped before work-items are flushed. This was not the problem I saw, but I think it may still be more correct. Signed-off-by: Ben Greear <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent cb601ff commit 9b5bd5a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

net/mac80211/mlme.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3502,6 +3502,14 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
35023502
{
35033503
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
35043504

3505+
/*
3506+
* Stop timers before deleting work items, as timers
3507+
* could race and re-add the work-items. They will be
3508+
* re-established on connection.
3509+
*/
3510+
del_timer_sync(&ifmgd->conn_mon_timer);
3511+
del_timer_sync(&ifmgd->bcn_mon_timer);
3512+
35053513
/*
35063514
* we need to use atomic bitops for the running bits
35073515
* only because both timers might fire at the same
@@ -3516,13 +3524,9 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
35163524
if (del_timer_sync(&ifmgd->timer))
35173525
set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
35183526

3519-
cancel_work_sync(&ifmgd->chswitch_work);
35203527
if (del_timer_sync(&ifmgd->chswitch_timer))
35213528
set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
3522-
3523-
/* these will just be re-established on connection */
3524-
del_timer_sync(&ifmgd->conn_mon_timer);
3525-
del_timer_sync(&ifmgd->bcn_mon_timer);
3529+
cancel_work_sync(&ifmgd->chswitch_work);
35263530
}
35273531

35283532
void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)

0 commit comments

Comments
 (0)