Skip to content

Commit 18db594

Browse files
committed
mac80211: fix scheduled scan rtnl deadlock
When changing cfg80211 to use RTNL locking, this caused a deadlock in mac80211 as it calls cfg80211_sched_scan_stopped() from a work item that's on a workqueue that is flushed with the RTNL held. Fix this by simply using schedule_work(), the work only needs to finish running before the wiphy is unregistered, no other synchronisation (e.g. with suspend) is really required since for suspend userspace is already blocked anyway when we flush the workqueue so will only pick up the event after resume. Cc: stable@vger.kernel.org Fixes: 5fe231e ("cfg80211: vastly simplify locking") Reported-and-tested-by: Eliad Peller <eliadx.peller@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 84a3d1c commit 18db594

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎net/mac80211/main.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
10471047

10481048
cancel_work_sync(&local->restart_work);
10491049
cancel_work_sync(&local->reconfig_filter);
1050+
flush_work(&local->sched_scan_stopped_work);
10501051

10511052
ieee80211_clear_tx_pending(local);
10521053
rate_control_deinitialize(local);

‎net/mac80211/scan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,6 @@ void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
10881088

10891089
trace_api_sched_scan_stopped(local);
10901090

1091-
ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work);
1091+
schedule_work(&local->sched_scan_stopped_work);
10921092
}
10931093
EXPORT_SYMBOL(ieee80211_sched_scan_stopped);

0 commit comments

Comments
 (0)