From 132a54f6468793348b5f713f59cb55c68ecfdba1 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Fri, 15 Mar 2013 22:29:27 +0000
Subject: mac80211: merge a fix for a race condition on station removal

SVN-Revision: 36053
---
 package/mac80211/patches/300-pending_work.patch | 32 +++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

(limited to 'package/mac80211')

diff --git a/package/mac80211/patches/300-pending_work.patch b/package/mac80211/patches/300-pending_work.patch
index 3d4e85ddd7..72a0081c16 100644
--- a/package/mac80211/patches/300-pending_work.patch
+++ b/package/mac80211/patches/300-pending_work.patch
@@ -896,3 +896,35 @@
  
  	if (needreset) {
  		ath_dbg(ath9k_hw_common(sc->sc_ah), RESET,
+--- a/net/mac80211/sta_info.c
++++ b/net/mac80211/sta_info.c
+@@ -766,6 +766,7 @@ int __must_check __sta_info_destroy(stru
+ 	struct ieee80211_local *local;
+ 	struct ieee80211_sub_if_data *sdata;
+ 	int ret, i;
++	bool have_key = false;
+ 
+ 	might_sleep();
+ 
+@@ -793,12 +794,19 @@ int __must_check __sta_info_destroy(stru
+ 	list_del_rcu(&sta->list);
+ 
+ 	mutex_lock(&local->key_mtx);
+-	for (i = 0; i < NUM_DEFAULT_KEYS; i++)
++	for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+ 		__ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i]));
+-	if (sta->ptk)
++		have_key = true;
++	}
++	if (sta->ptk) {
+ 		__ieee80211_key_free(key_mtx_dereference(local, sta->ptk));
++		have_key = true;
++	}
+ 	mutex_unlock(&local->key_mtx);
+ 
++	if (!have_key)
++		synchronize_net();
++
+ 	sta->dead = true;
+ 
+ 	local->num_sta--;
-- 
cgit v1.2.3