diff options
| author | Mikhail Lobanov <[email protected]> | 2025-03-17 10:31:37 +0000 |
|---|---|---|
| committer | Johannes Berg <[email protected]> | 2025-03-18 09:27:33 +0000 |
| commit | 16ee3ea8faef8ff042acc15867a6c458c573de61 (patch) | |
| tree | 8a8f615a7d38f8f50b3fa01aa44a69a40f4fbd17 | |
| parent | wifi: mac80211: fix indentation in ieee80211_set_monitor_channel() (diff) | |
| download | kernel-16ee3ea8faef8ff042acc15867a6c458c573de61.tar.gz kernel-16ee3ea8faef8ff042acc15867a6c458c573de61.zip | |
wifi: mac80211: check basic rates validity in sta_link_apply_parameters
When userspace sets supported rates for a new station via
NL80211_CMD_NEW_STATION, it might send a list that's empty
or contains only invalid values. Currently, we process these
values in sta_link_apply_parameters() without checking the result of
ieee80211_parse_bitrates(), which can lead to an empty rates bitmap.
A similar issue was addressed for NL80211_CMD_SET_BSS in commit
ce04abc3fcc6 ("wifi: mac80211: check basic rates validity").
This patch applies the same approach in sta_link_apply_parameters()
for NL80211_CMD_NEW_STATION, ensuring there is at least one valid
rate by inspecting the result of ieee80211_parse_bitrates().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Fixes: b95eb7f0eee4 ("wifi: cfg80211/mac80211: separate link params from station params")
Signed-off-by: Mikhail Lobanov <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
| -rw-r--r-- | net/mac80211/cfg.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 211ad64cfcdf..9f683f838431 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1907,12 +1907,12 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, } if (params->supported_rates && - params->supported_rates_len) { - ieee80211_parse_bitrates(link->conf->chanreq.oper.width, - sband, params->supported_rates, - params->supported_rates_len, - &link_sta->pub->supp_rates[sband->band]); - } + params->supported_rates_len && + !ieee80211_parse_bitrates(link->conf->chanreq.oper.width, + sband, params->supported_rates, + params->supported_rates_len, + &link_sta->pub->supp_rates[sband->band])) + return -EINVAL; if (params->ht_capa) ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, |
