Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90808
b: refs/heads/master
c: b16bd15
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Apr 16, 2008
1 parent 913061e commit f096883
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b914c521687ae6cb8923c7235fd69b7bc027703
refs/heads/master: b16bd15c379410f2aa47837aa4a0de5712856ad5
10 changes: 8 additions & 2 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ struct ieee80211_local {
/*
* The lock only protects the list, hash, timer and counter
* against manipulation, reads are done in RCU. Additionally,
* the lock protects each BSS's TIM bitmap, a few items in
* STA info structures and various key pointers.
* the lock protects each BSS's TIM bitmap.
*/
spinlock_t sta_lock;
unsigned long num_sta;
Expand Down Expand Up @@ -635,6 +634,13 @@ struct ieee80211_local {

struct list_head interfaces;

/*
* Key lock, protects sdata's key_list and sta_info's
* key pointers (write access, they're RCU.)
*/
spinlock_t key_lock;


bool sta_sw_scanning;
bool sta_hw_scanning;
int scan_channel_idx;
Expand Down
20 changes: 10 additions & 10 deletions trunk/net/mac80211/key.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx)
{
unsigned long flags;

spin_lock_irqsave(&sdata->local->sta_lock, flags);
spin_lock_irqsave(&sdata->local->key_lock, flags);
__ieee80211_set_default_key(sdata, idx);
spin_unlock_irqrestore(&sdata->local->sta_lock, flags);
spin_unlock_irqrestore(&sdata->local->key_lock, flags);
}


Expand Down Expand Up @@ -339,7 +339,7 @@ void ieee80211_key_link(struct ieee80211_key *key,
}
}

spin_lock_irqsave(&sdata->local->sta_lock, flags);
spin_lock_irqsave(&sdata->local->key_lock, flags);

if (sta)
old_key = sta->key;
Expand All @@ -348,7 +348,7 @@ void ieee80211_key_link(struct ieee80211_key *key,

__ieee80211_key_replace(sdata, sta, old_key, key);

spin_unlock_irqrestore(&sdata->local->sta_lock, flags);
spin_unlock_irqrestore(&sdata->local->key_lock, flags);

/* free old key later */
add_todo(old_key, KEY_FLAG_TODO_DELETE);
Expand Down Expand Up @@ -377,9 +377,9 @@ void ieee80211_key_free(struct ieee80211_key *key)
if (!key)
return;

spin_lock_irqsave(&key->sdata->local->sta_lock, flags);
spin_lock_irqsave(&key->sdata->local->key_lock, flags);
__ieee80211_key_free(key);
spin_unlock_irqrestore(&key->sdata->local->sta_lock, flags);
spin_unlock_irqrestore(&key->sdata->local->key_lock, flags);
}

/*
Expand All @@ -397,10 +397,10 @@ static void ieee80211_todo_for_each_key(struct ieee80211_sub_if_data *sdata,

might_sleep();

spin_lock_irqsave(&sdata->local->sta_lock, flags);
spin_lock_irqsave(&sdata->local->key_lock, flags);
list_for_each_entry(key, &sdata->key_list, list)
add_todo(key, todo_flags);
spin_unlock_irqrestore(&sdata->local->sta_lock, flags);
spin_unlock_irqrestore(&sdata->local->key_lock, flags);

ieee80211_key_todo();
}
Expand Down Expand Up @@ -506,10 +506,10 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata)

ieee80211_debugfs_key_remove_default(sdata);

spin_lock_irqsave(&sdata->local->sta_lock, flags);
spin_lock_irqsave(&sdata->local->key_lock, flags);
list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
__ieee80211_key_free(key);
spin_unlock_irqrestore(&sdata->local->sta_lock, flags);
spin_unlock_irqrestore(&sdata->local->key_lock, flags);

__ieee80211_key_todo();

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,8 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

INIT_LIST_HEAD(&local->interfaces);

spin_lock_init(&local->key_lock);

INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work);

sta_info_init(local);
Expand Down

0 comments on commit f096883

Please sign in to comment.