]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mac80211: fix station entry leak/warning while suspending
authorJohannes Berg <johannes.berg@intel.com>
Wed, 17 Apr 2013 09:26:40 +0000 (11:26 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 17 Apr 2013 09:40:39 +0000 (11:40 +0200)
Since Stanislaw's patches, when suspending while connected,
cfg80211 will disconnect. This causes the AP station to be
removed, which uses call_rcu() to clean up. Due to needing
process context, this queues a work struct on the mac80211
workqueue. This will warn and fail when already suspended,
which can happen if the rcu call doesn't happen quickly.

To fix this, replace the synchronize_net() which is really
just synchronize_rcu_expedited() with rcu_barrier(), which
unlike synchronize_rcu() waits until RCU callback have run
and thus avoids this issue.

In theory, this can even happen without Stanislaw's change
to disconnect on suspend since userspace might disconnect
just before suspending, though then it's unlikely that the
call_rcu() will be delayed long enough.

Cc: stable@vger.kernel.org [3.7+]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/pm.c

index d1c021b62fe5abbe1609f25546895f5db0ed91bc..4431f0ffe1577ea02e14597fd8fb191b00c31489 100644 (file)
@@ -37,8 +37,8 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
                                        IEEE80211_MAX_QUEUE_MAP,
                                        IEEE80211_QUEUE_STOP_REASON_SUSPEND);
 
-       /* flush out all packets */
-       synchronize_net();
+       /* flush out all packets and station cleanup call_rcu()s */
+       rcu_barrier();
 
        ieee80211_flush_queues(local, NULL);