]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/mac80211/sta_info.c
mac80211: fix ieee80211_find_sta[_by_hw]
[net-next-2.6.git] / net / mac80211 / sta_info.c
index 3de7a2260d651b33cf28b1591ca864ac6b2e561a..730197591ab5135e307317d7c9d8e358dae6bceb 100644 (file)
@@ -855,8 +855,12 @@ struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw,
        struct sta_info *sta, *nxt;
 
        /* Just return a random station ... first in list ... */
-       for_each_sta_info(hw_to_local(hw), addr, sta, nxt)
+       for_each_sta_info(hw_to_local(hw), addr, sta, nxt) {
+               if (!sta->uploaded)
+                       return NULL;
                return &sta->sta;
+       }
+
        return NULL;
 }
 EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw);
@@ -864,14 +868,19 @@ EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_hw);
 struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
                                         const u8 *addr)
 {
-       struct ieee80211_sub_if_data *sdata;
+       struct sta_info *sta;
 
        if (!vif)
                return NULL;
 
-       sdata = vif_to_sdata(vif);
+       sta = sta_info_get_bss(vif_to_sdata(vif), addr);
+       if (!sta)
+               return NULL;
+
+       if (!sta->uploaded)
+               return NULL;
 
-       return ieee80211_find_sta_by_hw(&sdata->local->hw, addr);
+       return &sta->sta;
 }
 EXPORT_SYMBOL(ieee80211_find_sta);