wifi: mac80211: check basic rates validity in sta_link_apply_parameters
PATCH 1/1 wifi: mac80211: check basic rates validity in sta_link_apply_parameters
From: Mikhail Lobanov <[email protected]>
[ Upstream commit 16ee3ea8faef8ff042acc15867a6c458c573de61 ]
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.
[ Summary of conflict resolutions:
- Function ieee80211_parse_bitrates() takes channel width as its first parameter in mainline kernel version. In v5.15 the function takes the whole chandef struct as its first parameter.
- The same function takes link station parameters as its last parameter, and in v5.15 they are in a struct called sta, instead of a struct called link_sta. ]
--- net/mac80211/cfg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/mac80211/cfg.c +7 -6
@@ -1658,12 +1658,13 @@ static int sta_apply_parameters(struct ieee80211_local *local,return ret; } -if (params->supported_rates && params->supported_rates_len) { -ieee80211_parse_bitrates (&sdata->vif.bss_conf.chandef, - sband, params->supported_rates, - params->supported_rates_len, - &sta->sta.supp_rates[sband->band]); - } +if (params->supported_rates && + params->supported_rates_len && + !ieee80211_parse_bitrates (&sdata->vif.bss_conf.chandef, + sband, params->supported_rates, + params->supported_rates_len, + &sta->sta.supp_rates[sband->band])) +return -EINVAL ;if (params->ht_capa) ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
Signature · 1 line
2.50.0