Skip to content

Commit 4fdbc67

Browse files
Maxim Altshuljmberg-intel
authored andcommitted
mac80211: call get_expected_throughput only after adding station
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 <[email protected]> [reword commit message] Signed-off-by: Johannes Berg <[email protected]>
1 parent 12d20fc commit 4fdbc67

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

net/mac80211/driver-ops.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,13 +1088,13 @@ static inline void drv_leave_ibss(struct ieee80211_local *local,
10881088
}
10891089

10901090
static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
1091-
struct ieee80211_sta *sta)
1091+
struct sta_info *sta)
10921092
{
10931093
u32 ret = 0;
10941094

1095-
trace_drv_get_expected_throughput(sta);
1096-
if (local->ops->get_expected_throughput)
1097-
ret = local->ops->get_expected_throughput(&local->hw, sta);
1095+
trace_drv_get_expected_throughput(&sta->sta);
1096+
if (local->ops->get_expected_throughput && sta->uploaded)
1097+
ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
10981098
trace_drv_return_u32(local, ret);
10991099

11001100
return ret;

net/mac80211/sta_info.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ u32 sta_get_expected_throughput(struct sta_info *sta)
23012301
if (ref && ref->ops->get_expected_throughput)
23022302
thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
23032303
else
2304-
thr = drv_get_expected_throughput(local, &sta->sta);
2304+
thr = drv_get_expected_throughput(local, sta);
23052305

23062306
return thr;
23072307
}

0 commit comments

Comments
 (0)