Skip to content

Commit

Permalink
mac80211: fix ieee80211_find_sta[_by_hw]
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg authored and John W. Linville committed May 3, 2010
1 parent c7ab1a4 commit f7c6559
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,23 +855,32 @@ 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);

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);

Expand Down

0 comments on commit f7c6559

Please sign in to comment.