Skip to content

Commit

Permalink
mac80211: fix rhashtable conversion
Browse files Browse the repository at this point in the history
My conversion of the mac80211 station hash table to rhashtable
completely broke the lookup in sta_info_get() as it no longer
took into account the virtual interface. Fix that.

Fixes: 7bedd0c ("mac80211: use rhashtable for station table")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Apr 23, 2015
1 parent 5eb8f4d commit 60f4b62
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,24 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
const u8 *addr)
{
struct ieee80211_local *local = sdata->local;
struct sta_info *sta;
struct rhash_head *tmp;
const struct bucket_table *tbl;

rcu_read_lock();
tbl = rht_dereference_rcu(local->sta_hash.tbl, &local->sta_hash);

return rhashtable_lookup_fast(&local->sta_hash, addr, sta_rht_params);
for_each_sta_info(local, tbl, addr, sta, tmp) {
if (sta->sdata == sdata) {
rcu_read_unlock();
/* this is safe as the caller must already hold
* another rcu read section or the mutex
*/
return sta;
}
}
rcu_read_unlock();
return NULL;
}

/*
Expand Down

0 comments on commit 60f4b62

Please sign in to comment.