mac80211: add a fix for racy drv_sta_rc_update calls
[openwrt/staging/981213.git] / package / kernel / mac80211 / patches / subsys / 331-wifi-mac80211-only-call-drv_sta_rc_update-for-upload.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 21 Feb 2024 14:41:40 +0100
3 Subject: [PATCH] wifi: mac80211: only call drv_sta_rc_update for uploaded
4 stations
5
6 When a station has not been uploaded yet, receiving SMPS or channel width
7 notification action frames can lead to rate_control_rate_update calling
8 drv_sta_rc_update with uninitialized driver private data.
9 Fix this by adding a missing check for sta->uploaded.
10
11 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 ---
13
14 --- a/net/mac80211/rate.c
15 +++ b/net/mac80211/rate.c
16 @@ -119,7 +119,8 @@ void rate_control_rate_update(struct iee
17 rcu_read_unlock();
18 }
19
20 - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
21 + if (sta->uploaded)
22 + drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
23 }
24
25 int ieee80211_rate_control_register(const struct rate_control_ops *ops)