• Simon Wunderlich's avatar
    mac80211: don't cancel csa finalize work within stop_ap · beffd138
    Simon Wunderlich authored
    The current channel switch code has a potential deadlock:
    1) * cfg80211_stop_ap acquires wdev-lock
       * ieee80211_stop_ap calls cancel_work_sync for the csa_finalize_work,
         which acquires the associated worker-lock
    2) * ieee80211_csa_finalize_work holds the worker-lock when run
       * it calls cfg80211_ch_switch_notify which will claim the wdev-lock,
         and also needs to claim the sdata-lock (which is the same as the
         wdev-lock) to modify the beacons.
    It is sufficient to just set the channel switch active to false. If the
    worker is running later, it will find the channel switch to not be
    active anymore and returns immediately without changing anything.
    Canceling the worker is done anyway when the interface goes down
    Reported-by: default avatarJohannes Berg <johannes@sipsolutions.net>
    Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
cfg.c 103 KB