mac80211: annotate station rcu dereferences
The new RCU lockdep support warns about these in some contexts -- make it aware of the locks used to protect all this. Different locks are used in different contexts which unfortunately means we can't get perfect checking. Also remove rcu_dereference() from two places that don't actually dereference the pointers. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
1cb561f837
commit
0379185b6c
@@ -93,12 +93,18 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
|
||||
struct ieee80211_local *local = sdata->local;
|
||||
struct sta_info *sta;
|
||||
|
||||
sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
|
||||
sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
|
||||
rcu_read_lock_held() ||
|
||||
lockdep_is_held(&local->sta_lock) ||
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
while (sta) {
|
||||
if (sta->sdata == sdata &&
|
||||
memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
|
||||
break;
|
||||
sta = rcu_dereference(sta->hnext);
|
||||
sta = rcu_dereference_check(sta->hnext,
|
||||
rcu_read_lock_held() ||
|
||||
lockdep_is_held(&local->sta_lock) ||
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
}
|
||||
return sta;
|
||||
}
|
||||
@@ -113,13 +119,19 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
|
||||
struct ieee80211_local *local = sdata->local;
|
||||
struct sta_info *sta;
|
||||
|
||||
sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
|
||||
sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)],
|
||||
rcu_read_lock_held() ||
|
||||
lockdep_is_held(&local->sta_lock) ||
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
while (sta) {
|
||||
if ((sta->sdata == sdata ||
|
||||
sta->sdata->bss == sdata->bss) &&
|
||||
memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
|
||||
break;
|
||||
sta = rcu_dereference(sta->hnext);
|
||||
sta = rcu_dereference_check(sta->hnext,
|
||||
rcu_read_lock_held() ||
|
||||
lockdep_is_held(&local->sta_lock) ||
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
}
|
||||
return sta;
|
||||
}
|
||||
|
Reference in New Issue
Block a user