Search Linux Wireless

[PATCH 11/12] mac80211: remove key mutex from subif data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All key handling is done under rtnl so this is not
necessary.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>

---
 net/mac80211/ieee80211_i.h     |    2 --
 net/mac80211/ieee80211_iface.c |    1 -
 net/mac80211/key.c             |   29 +++++------------------------
 3 files changed, 5 insertions(+), 27 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_i.h	2007-08-28 17:52:41.074622115 +0200
+++ wireless-dev/net/mac80211/ieee80211_i.h	2007-08-28 17:54:24.274622115 +0200
@@ -22,7 +22,6 @@
 #include <linux/types.h>
 #include <linux/spinlock.h>
 #include <linux/etherdevice.h>
-#include <linux/mutex.h>
 #include <net/wireless.h>
 #include "ieee80211_key.h"
 #include "sta_info.h"
@@ -330,7 +329,6 @@ struct ieee80211_sub_if_data {
 	struct wireless_dev wdev;
 
 	/* keys */
-	struct mutex key_mtx;
 	struct list_head key_list;
 
 	struct net_device *dev;
--- wireless-dev.orig/net/mac80211/key.c	2007-08-28 17:53:21.034622115 +0200
+++ wireless-dev/net/mac80211/key.c	2007-08-28 17:55:03.354622115 +0200
@@ -30,6 +30,9 @@
  * it cannot do that they key is simply kept for software encryption.
  * There is currently no way of knowing this except by looking into
  * debugfs.
+ *
+ * All operations here are called under RTNL so no extra locking is
+ * required.
  */
 
 static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
@@ -186,9 +189,7 @@ struct ieee80211_key *ieee80211_key_allo
 			WARN_ON(1);
 	}
 
-	mutex_lock(&sdata->key_mtx);
 	list_add(&key->list, &sdata->key_list);
-	mutex_unlock(&sdata->key_mtx);
 
 	if (netif_running(key->sdata->dev))
 		ieee80211_key_enable_hw_accel(key);
@@ -196,7 +197,7 @@ struct ieee80211_key *ieee80211_key_allo
 	return key;
 }
 
-static void __ieee80211_key_free(struct ieee80211_key *key)
+void ieee80211_key_free(struct ieee80211_key *key)
 {
 	if (!key)
 		return;
@@ -224,20 +225,6 @@ static void __ieee80211_key_free(struct 
 	kfree(key);
 }
 
-void ieee80211_key_free(struct ieee80211_key *key)
-{
-	struct ieee80211_sub_if_data *sdata;
-
-	if (!key)
-		return;
-
-	sdata = key->sdata;
-
-	mutex_lock(&sdata->key_mtx);
-	__ieee80211_key_free(key);
-	mutex_unlock(&sdata->key_mtx);
-}
-
 void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx)
 {
 	struct ieee80211_key *key = NULL;
@@ -263,10 +250,8 @@ void ieee80211_free_keys(struct ieee8021
 {
 	struct ieee80211_key *key, *tmp;
 
-	mutex_lock(&sdata->key_mtx);
 	list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
-		__ieee80211_key_free(key);
-	mutex_unlock(&sdata->key_mtx);
+		ieee80211_key_free(key);
 }
 
 void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
@@ -277,18 +262,14 @@ void ieee80211_enable_keys(struct ieee80
 	if (!netif_running(sdata->dev))
 		return;
 
-	mutex_lock(&sdata->key_mtx);
 	list_for_each_entry(key, &sdata->key_list, list)
 		ieee80211_key_enable_hw_accel(key);
-	mutex_unlock(&sdata->key_mtx);
 }
 
 void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_key *key;
 
-	mutex_lock(&sdata->key_mtx);
 	list_for_each_entry(key, &sdata->key_list, list)
 		ieee80211_key_disable_hw_accel(key);
-	mutex_unlock(&sdata->key_mtx);
 }
--- wireless-dev.orig/net/mac80211/ieee80211_iface.c	2007-08-28 17:53:20.404622115 +0200
+++ wireless-dev/net/mac80211/ieee80211_iface.c	2007-08-28 17:54:21.634622115 +0200
@@ -26,7 +26,6 @@ void ieee80211_if_sdata_init(struct ieee
 	for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++)
 		skb_queue_head_init(&sdata->fragments[i].skb_list);
 
-	mutex_init(&sdata->key_mtx);
 	INIT_LIST_HEAD(&sdata->key_list);
 }
 

-- 

-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux