diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2010-04-30 07:48:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-03 14:51:47 -0400 |
commit | f7c65594f7148b778f41d591a701e94bb22428e4 (patch) | |
tree | f5ffe3353a5061c5251c6e5a1575a8338487da2a /net/mac80211 | |
parent | c7ab1a4dcb8fb63364e9460b1182da6eae5f0d16 (diff) |
mac80211: fix ieee80211_find_sta[_by_hw]
Both of these functions can currently return
a station pointer that, to the driver, is
invalid (in IBSS mode only) because adding
the station failed. Check for that, and also
make ieee80211_find_sta() properly use the
per interface station search.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/sta_info.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 3de7a2260d65..730197591ab5 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -855,8 +855,12 @@ struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, | |||
855 | struct sta_info *sta, *nxt; | 855 | struct sta_info *sta, *nxt; |
856 | 856 | ||
857 | /* Just return a random station ... first in list ... */ | 857 | /* Just return a random station ... first in list ... */ |
858 | for_each_sta_info(hw_to_local(hw), addr, sta, nxt) | 858 | for_each_sta_info(hw_to_local(hw), addr, sta, nxt) { |
859 | if (!sta->uploaded) | ||
860 | return NULL; | ||
859 | return &sta->sta; | 861 | return &sta->sta; |
862 | } | ||
863 | |||
860 | return NULL; | 864 | return NULL; |
861 | } | 865 | } |
862 | EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); | 866 | EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); |
@@ -864,14 +868,19 @@ EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw); | |||
864 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, | 868 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, |
865 | const u8 *addr) | 869 | const u8 *addr) |
866 | { | 870 | { |
867 | struct ieee80211_sub_if_data *sdata; | 871 | struct sta_info *sta; |
868 | 872 | ||
869 | if (!vif) | 873 | if (!vif) |
870 | return NULL; | 874 | return NULL; |
871 | 875 | ||
872 | sdata = vif_to_sdata(vif); | 876 | sta = sta_info_get_bss(vif_to_sdata(vif), addr); |
877 | if (!sta) | ||
878 | return NULL; | ||
879 | |||
880 | if (!sta->uploaded) | ||
881 | return NULL; | ||
873 | 882 | ||
874 | return ieee80211_find_sta_by_hw(&sdata->local->hw, addr); | 883 | return &sta->sta; |
875 | } | 884 | } |
876 | EXPORT_SYMBOL(ieee80211_find_sta); | 885 | EXPORT_SYMBOL(ieee80211_find_sta); |
877 | 886 | ||