diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-04-08 11:56:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-08 16:44:45 -0400 |
commit | 3b96766f0e643f52ae19e134664df6730c737e87 (patch) | |
tree | b1707d94a14c9777f09b1aab33970e7741190d4c /net/mac80211/debugfs_key.h | |
parent | 7d1559f1737d5ca27b267b0392015f42b3bbe2fa (diff) |
mac80211: fix key vs. sta locking problems
Up to now, key manipulation is supposed to run under RTNL to
avoid concurrent manipulations and also allow the set_key()
hardware callback to sleep. This is not feasible because STA
structs are rcu-protected and thus a lot of operations there
cannot take the RTNL. Also, key references are rcu-protected
so we cannot do things atomically.
This patch changes key locking completely:
* key operations are now atomic
* hardware crypto offload is enabled and disabled from
a workqueue, due to that key freeing is also delayed
* debugfs code is also run from a workqueue
* keys reference STAs (and vice versa!) so during STA
unlink the STAs key reference is removed but not the
keys STA reference, to avoid races key todo work is
run before STA destruction.
* fewer STA operations now need the RTNL which was
required due to key operations
This fixes the locking problems lockdep pointed out and also
makes things more light-weight because the rtnl isn't required
as much.
Note that the key todo lock/key mutex are global locks, this
is not required, of course, they could be per-hardware instead.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/debugfs_key.h')
-rw-r--r-- | net/mac80211/debugfs_key.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/net/mac80211/debugfs_key.h b/net/mac80211/debugfs_key.h index aecfce395da6..b1a3754ee240 100644 --- a/net/mac80211/debugfs_key.h +++ b/net/mac80211/debugfs_key.h | |||
@@ -2,18 +2,14 @@ | |||
2 | #define __MAC80211_DEBUGFS_KEY_H | 2 | #define __MAC80211_DEBUGFS_KEY_H |
3 | 3 | ||
4 | #ifdef CONFIG_MAC80211_DEBUGFS | 4 | #ifdef CONFIG_MAC80211_DEBUGFS |
5 | void ieee80211_debugfs_key_add(struct ieee80211_local *local, | 5 | void ieee80211_debugfs_key_add(struct ieee80211_key *key); |
6 | struct ieee80211_key *key); | ||
7 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key); | 6 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key); |
8 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata); | 7 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata); |
9 | void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata); | 8 | void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata); |
10 | void ieee80211_debugfs_key_sta_link(struct ieee80211_key *key, | ||
11 | struct sta_info *sta); | ||
12 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 9 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
13 | struct sta_info *sta); | 10 | struct sta_info *sta); |
14 | #else | 11 | #else |
15 | static inline void ieee80211_debugfs_key_add(struct ieee80211_local *local, | 12 | static inline void ieee80211_debugfs_key_add(struct ieee80211_key *key) |
16 | struct ieee80211_key *key) | ||
17 | {} | 13 | {} |
18 | static inline void ieee80211_debugfs_key_remove(struct ieee80211_key *key) | 14 | static inline void ieee80211_debugfs_key_remove(struct ieee80211_key *key) |
19 | {} | 15 | {} |
@@ -23,9 +19,6 @@ static inline void ieee80211_debugfs_key_add_default( | |||
23 | static inline void ieee80211_debugfs_key_remove_default( | 19 | static inline void ieee80211_debugfs_key_remove_default( |
24 | struct ieee80211_sub_if_data *sdata) | 20 | struct ieee80211_sub_if_data *sdata) |
25 | {} | 21 | {} |
26 | static inline void ieee80211_debugfs_key_sta_link( | ||
27 | struct ieee80211_key *key, struct sta_info *sta) | ||
28 | {} | ||
29 | static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 22 | static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
30 | struct sta_info *sta) | 23 | struct sta_info *sta) |
31 | {} | 24 | {} |