Skip to content

Commit

Permalink
mac80211: call get_expected_throughput only after adding station
Browse files Browse the repository at this point in the history
Depending on which method the driver implements, userspace could
call this (indirectly, by getting station info) before the driver
knows about the station, possibly causing it to misbehave.

Therefore, add a check for sta->uploaded which indicates that the
driver knows about the station.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
[reword commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Maxim Altshul authored and Johannes Berg committed Aug 11, 2016
1 parent 12d20fc commit 4fdbc67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -1088,13 +1088,13 @@ static inline void drv_leave_ibss(struct ieee80211_local *local,
}

static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
struct ieee80211_sta *sta)
struct sta_info *sta)
{
u32 ret = 0;

trace_drv_get_expected_throughput(sta);
if (local->ops->get_expected_throughput)
ret = local->ops->get_expected_throughput(&local->hw, sta);
trace_drv_get_expected_throughput(&sta->sta);
if (local->ops->get_expected_throughput && sta->uploaded)
ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
trace_drv_return_u32(local, ret);

return ret;
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ u32 sta_get_expected_throughput(struct sta_info *sta)
if (ref && ref->ops->get_expected_throughput)
thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
else
thr = drv_get_expected_throughput(local, &sta->sta);
thr = drv_get_expected_throughput(local, sta);

return thr;
}
Expand Down

0 comments on commit 4fdbc67

Please sign in to comment.