linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] mac80211: perform scan cancel in hw reset work
@ 2010-10-01 12:05 Stanislaw Gruszka
  2010-10-01 12:05 ` [PATCH 2/6] mac80211: merge ieee80211_scan_work() common code Stanislaw Gruszka
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Stanislaw Gruszka @ 2010-10-01 12:05 UTC (permalink / raw)
  To: Johannes Berg, Wey-Yi Guy
  Cc: John W. Linville, linux-wireless, Stanislaw Gruszka

Move ieee80211_scan_cancel() and all other related code to
ieee80211_restart_work() as ieee80211_restart_hw() is intended to be
callable from any context.

Fix a bug that RTNL lock is not taken during ieee80211_cancel_scan().

Take local->mtx before WARN(test_bit(SCAN_HW_SCANNING, &local->scanning)
to prevent the race condition with __ieee80211_start_scan() described
here: http://marc.info/?l=linux-wireless&m=128516716810537&w=2

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 net/mac80211/main.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index e24fa5b..494dba1 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -295,7 +295,17 @@ static void ieee80211_restart_work(struct work_struct *work)
 	struct ieee80211_local *local =
 		container_of(work, struct ieee80211_local, restart_work);
 
+	/* wait for scan work complete */
+	flush_workqueue(local->workqueue);
+
+	mutex_lock(&local->mtx);
+	WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
+		"%s called with hardware scan in progress\n", __func__);
+	mutex_unlock(&local->mtx);
+
 	rtnl_lock();
+	if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)))
+		ieee80211_scan_cancel(local);
 	ieee80211_reconfig(local);
 	rtnl_unlock();
 }
@@ -306,15 +316,6 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw)
 
 	trace_api_restart_hw(local);
 
-	/* wait for scan work complete */
-	flush_workqueue(local->workqueue);
-
-	WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
-		"%s called with hardware scan in progress\n", __func__);
-
-	if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)))
-		ieee80211_scan_cancel(local);
-
 	/* use this reason, ieee80211_reconfig will unblock it */
 	ieee80211_stop_queues_by_reason(hw,
 		IEEE80211_QUEUE_STOP_REASON_SUSPEND);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-10-05  9:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 12:05 [PATCH 1/6] mac80211: perform scan cancel in hw reset work Stanislaw Gruszka
2010-10-01 12:05 ` [PATCH 2/6] mac80211: merge ieee80211_scan_work() common code Stanislaw Gruszka
2010-10-04 13:02   ` Johannes Berg
2010-10-04 13:07   ` Johannes Berg
2010-10-01 12:05 ` [PATCH 3/6] mac80211: keep lock when calling __ieee80211_scan_completed() Stanislaw Gruszka
2010-10-04 13:09   ` Johannes Berg
2010-10-04 14:52     ` Stanislaw Gruszka
2010-10-01 12:05 ` [PATCH 4/6] mac80211: assure we also cancel deferred scan request Stanislaw Gruszka
2010-10-04 13:11   ` Johannes Berg
2010-10-04 15:17     ` Stanislaw Gruszka
2010-10-01 12:05 ` [PATCH 5/6] mac80211: do not requeue scan work when not needed Stanislaw Gruszka
2010-10-01 12:05 ` [PATCH 6/6] Revert "iwlwifi: do not perferm force reset while doing scan" Stanislaw Gruszka
2010-10-01 16:11 ` [PATCH 1/6] mac80211: perform scan cancel in hw reset work Johannes Berg
2010-10-01 17:20   ` Luis R. Rodriguez
2010-10-05  9:25     ` Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).