public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix ibss race
@ 2009-10-11  9:47 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2009-10-11  9:47 UTC (permalink / raw)
  To: John Linville; +Cc: Felix Fietkau, linux-wireless

When a scan completes, we call ieee80211_sta_find_ibss(),
which is also called from other places. When the scan was
done in software, there's no problem as both run from the
single-threaded mac80211 workqueue and are thus serialised
against each other, but with hardware scan the completion
can be in a different context and race against callers of
this function from the workqueue (e.g. due to beacon RX).
So instead of calling ieee80211_sta_find_ibss() directly,
just arm the timer and have it fire, scheduling the work,
which will invoke ieee80211_sta_find_ibss() (if that is
appropriate in the current state).

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/ibss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- wireless-testing.orig/net/mac80211/ibss.c	2009-10-02 10:41:44.000000000 +0200
+++ wireless-testing/net/mac80211/ibss.c	2009-10-06 14:57:27.000000000 +0200
@@ -831,7 +831,7 @@ void ieee80211_ibss_notify_scan_complete
 		if (!sdata->u.ibss.ssid_len)
 			continue;
 		sdata->u.ibss.last_scan_completed = jiffies;
-		ieee80211_sta_find_ibss(sdata);
+		mod_timer(&sdata->u.ibss.timer, 0);
 	}
 	mutex_unlock(&local->iflist_mtx);
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-11  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-11  9:47 [PATCH] mac80211: fix ibss race Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox