aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-12-08 09:04:38 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-12-15 07:12:50 -0500
commit74430f9489a3b6116a5c144eea2bc62cd52012f6 (patch)
tree096c0e6a272326a0a2dcf11aba840cc9715f6bb1 /net/mac80211/util.c
parent707554b4d117330e58374990b6c27ded650dc684 (diff)
mac80211: run scan completed work on reconfig failure
When reconfiguration during resume fails while a scan is pending for completion work, that work will never run, and the scan will be stuck forever. Factor out the code to recover this and call it also in ieee80211_handle_reconfig_failure(). Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 74058020b7d6..f9a8d1401ba4 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1641,6 +1641,29 @@ void ieee80211_stop_device(struct ieee80211_local *local)
1641 drv_stop(local); 1641 drv_stop(local);
1642} 1642}
1643 1643
1644static void ieee80211_flush_completed_scan(struct ieee80211_local *local,
1645 bool aborted)
1646{
1647 /* It's possible that we don't handle the scan completion in
1648 * time during suspend, so if it's still marked as completed
1649 * here, queue the work and flush it to clean things up.
1650 * Instead of calling the worker function directly here, we
1651 * really queue it to avoid potential races with other flows
1652 * scheduling the same work.
1653 */
1654 if (test_bit(SCAN_COMPLETED, &local->scanning)) {
1655 /* If coming from reconfiguration failure, abort the scan so
1656 * we don't attempt to continue a partial HW scan - which is
1657 * possible otherwise if (e.g.) the 2.4 GHz portion was the
1658 * completed scan, and a 5 GHz portion is still pending.
1659 */
1660 if (aborted)
1661 set_bit(SCAN_ABORTED, &local->scanning);
1662 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0);
1663 flush_delayed_work(&local->scan_work);
1664 }
1665}
1666
1644static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) 1667static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
1645{ 1668{
1646 struct ieee80211_sub_if_data *sdata; 1669 struct ieee80211_sub_if_data *sdata;
@@ -1660,6 +1683,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
1660 local->suspended = false; 1683 local->suspended = false;
1661 local->in_reconfig = false; 1684 local->in_reconfig = false;
1662 1685
1686 ieee80211_flush_completed_scan(local, true);
1687
1663 /* scheduled scan clearly can't be running any more, but tell 1688 /* scheduled scan clearly can't be running any more, but tell
1664 * cfg80211 and clear local state 1689 * cfg80211 and clear local state
1665 */ 1690 */
@@ -2074,17 +2099,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
2074 mb(); 2099 mb();
2075 local->resuming = false; 2100 local->resuming = false;
2076 2101
2077 /* It's possible that we don't handle the scan completion in 2102 ieee80211_flush_completed_scan(local, false);
2078 * time during suspend, so if it's still marked as completed
2079 * here, queue the work and flush it to clean things up.
2080 * Instead of calling the worker function directly here, we
2081 * really queue it to avoid potential races with other flows
2082 * scheduling the same work.
2083 */
2084 if (test_bit(SCAN_COMPLETED, &local->scanning)) {
2085 ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0);
2086 flush_delayed_work(&local->scan_work);
2087 }
2088 2103
2089 if (local->open_count && !reconfig_due_to_wowlan) 2104 if (local->open_count && !reconfig_due_to_wowlan)
2090 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); 2105 drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND);