1 --- a/net/mac80211/sta_info.c
2 +++ b/net/mac80211/sta_info.c
3 @@ -119,6 +119,27 @@ struct sta_info *sta_info_get(struct iee
8 + * Get sta info either from the specified interface
9 + * or from one of its vlans
11 +struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
14 + struct ieee80211_local *local = sdata->local;
15 + struct sta_info *sta;
17 + sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);
19 + if ((sta->sdata == sdata ||
20 + sta->sdata->bss == sdata->bss) &&
21 + memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
23 + sta = rcu_dereference(sta->hnext);
28 struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
31 --- a/net/mac80211/sta_info.h
32 +++ b/net/mac80211/sta_info.h
33 @@ -408,6 +408,9 @@ static inline u32 get_sta_flags(struct s
34 struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
37 +struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
41 void for_each_sta_info_type_check(struct ieee80211_local *local,
43 --- a/net/mac80211/cfg.c
44 +++ b/net/mac80211/cfg.c
45 @@ -148,7 +148,7 @@ static int ieee80211_add_key(struct wiph
49 - sta = sta_info_get(sdata, mac_addr);
50 + sta = sta_info_get_bss(sdata, mac_addr);
52 ieee80211_key_free(key);
54 @@ -179,7 +179,7 @@ static int ieee80211_del_key(struct wiph
58 - sta = sta_info_get(sdata, mac_addr);
59 + sta = sta_info_get_bss(sdata, mac_addr);
63 @@ -226,7 +226,7 @@ static int ieee80211_get_key(struct wiph
67 - sta = sta_info_get(sdata, mac_addr);
68 + sta = sta_info_get_bss(sdata, mac_addr);
72 @@ -419,7 +419,7 @@ static int ieee80211_get_station(struct
76 - sta = sta_info_get(sdata, mac);
77 + sta = sta_info_get_bss(sdata, mac);
80 sta_set_sinfo(sta, sinfo);
81 @@ -775,7 +775,7 @@ static int ieee80211_del_station(struct
85 - sta = sta_info_get(sdata, mac);
86 + sta = sta_info_get_bss(sdata, mac);
90 @@ -803,7 +803,7 @@ static int ieee80211_change_station(stru
94 - sta = sta_info_get(sdata, mac);
95 + sta = sta_info_get_bss(sdata, mac);