diff options
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r-- | net/mac80211/key.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index ce267565e180..659a42d529e3 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -67,6 +67,8 @@ static DECLARE_WORK(todo_work, key_todo); | |||
67 | * | 67 | * |
68 | * @key: key to add to do item for | 68 | * @key: key to add to do item for |
69 | * @flag: todo flag(s) | 69 | * @flag: todo flag(s) |
70 | * | ||
71 | * Must be called with IRQs or softirqs disabled. | ||
70 | */ | 72 | */ |
71 | static void add_todo(struct ieee80211_key *key, u32 flag) | 73 | static void add_todo(struct ieee80211_key *key, u32 flag) |
72 | { | 74 | { |
@@ -140,9 +142,9 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
140 | ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); | 142 | ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); |
141 | 143 | ||
142 | if (!ret) { | 144 | if (!ret) { |
143 | spin_lock(&todo_lock); | 145 | spin_lock_bh(&todo_lock); |
144 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; | 146 | key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; |
145 | spin_unlock(&todo_lock); | 147 | spin_unlock_bh(&todo_lock); |
146 | } | 148 | } |
147 | 149 | ||
148 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) | 150 | if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) |
@@ -164,12 +166,12 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
164 | if (!key || !key->local->ops->set_key) | 166 | if (!key || !key->local->ops->set_key) |
165 | return; | 167 | return; |
166 | 168 | ||
167 | spin_lock(&todo_lock); | 169 | spin_lock_bh(&todo_lock); |
168 | if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { | 170 | if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { |
169 | spin_unlock(&todo_lock); | 171 | spin_unlock_bh(&todo_lock); |
170 | return; | 172 | return; |
171 | } | 173 | } |
172 | spin_unlock(&todo_lock); | 174 | spin_unlock_bh(&todo_lock); |
173 | 175 | ||
174 | sta = get_sta_for_key(key); | 176 | sta = get_sta_for_key(key); |
175 | sdata = key->sdata; | 177 | sdata = key->sdata; |
@@ -188,9 +190,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) | |||
188 | wiphy_name(key->local->hw.wiphy), | 190 | wiphy_name(key->local->hw.wiphy), |
189 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); | 191 | key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); |
190 | 192 | ||
191 | spin_lock(&todo_lock); | 193 | spin_lock_bh(&todo_lock); |
192 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; | 194 | key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; |
193 | spin_unlock(&todo_lock); | 195 | spin_unlock_bh(&todo_lock); |
194 | } | 196 | } |
195 | 197 | ||
196 | static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, | 198 | static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, |
@@ -437,14 +439,14 @@ void ieee80211_key_link(struct ieee80211_key *key, | |||
437 | 439 | ||
438 | __ieee80211_key_replace(sdata, sta, old_key, key); | 440 | __ieee80211_key_replace(sdata, sta, old_key, key); |
439 | 441 | ||
440 | spin_unlock_irqrestore(&sdata->local->key_lock, flags); | ||
441 | |||
442 | /* free old key later */ | 442 | /* free old key later */ |
443 | add_todo(old_key, KEY_FLAG_TODO_DELETE); | 443 | add_todo(old_key, KEY_FLAG_TODO_DELETE); |
444 | 444 | ||
445 | add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS); | 445 | add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS); |
446 | if (netif_running(sdata->dev)) | 446 | if (netif_running(sdata->dev)) |
447 | add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD); | 447 | add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD); |
448 | |||
449 | spin_unlock_irqrestore(&sdata->local->key_lock, flags); | ||
448 | } | 450 | } |
449 | 451 | ||
450 | static void __ieee80211_key_free(struct ieee80211_key *key) | 452 | static void __ieee80211_key_free(struct ieee80211_key *key) |
@@ -547,7 +549,7 @@ static void __ieee80211_key_todo(void) | |||
547 | */ | 549 | */ |
548 | synchronize_rcu(); | 550 | synchronize_rcu(); |
549 | 551 | ||
550 | spin_lock(&todo_lock); | 552 | spin_lock_bh(&todo_lock); |
551 | while (!list_empty(&todo_list)) { | 553 | while (!list_empty(&todo_list)) { |
552 | key = list_first_entry(&todo_list, struct ieee80211_key, todo); | 554 | key = list_first_entry(&todo_list, struct ieee80211_key, todo); |
553 | list_del_init(&key->todo); | 555 | list_del_init(&key->todo); |
@@ -558,7 +560,7 @@ static void __ieee80211_key_todo(void) | |||
558 | KEY_FLAG_TODO_HWACCEL_REMOVE | | 560 | KEY_FLAG_TODO_HWACCEL_REMOVE | |
559 | KEY_FLAG_TODO_DELETE); | 561 | KEY_FLAG_TODO_DELETE); |
560 | key->flags &= ~todoflags; | 562 | key->flags &= ~todoflags; |
561 | spin_unlock(&todo_lock); | 563 | spin_unlock_bh(&todo_lock); |
562 | 564 | ||
563 | work_done = false; | 565 | work_done = false; |
564 | 566 | ||
@@ -591,9 +593,9 @@ static void __ieee80211_key_todo(void) | |||
591 | 593 | ||
592 | WARN_ON(!work_done); | 594 | WARN_ON(!work_done); |
593 | 595 | ||
594 | spin_lock(&todo_lock); | 596 | spin_lock_bh(&todo_lock); |
595 | } | 597 | } |
596 | spin_unlock(&todo_lock); | 598 | spin_unlock_bh(&todo_lock); |
597 | } | 599 | } |
598 | 600 | ||
599 | void ieee80211_key_todo(void) | 601 | void ieee80211_key_todo(void) |