Skip to content

Commit e442a96

Browse files
Mikhail Lobanovgregkh
authored andcommitted
wifi: mac80211: check basic rates validity in sta_link_apply_parameters
commit 16ee3ea upstream. 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 ce04abc ("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: b95eb7f ("wifi: cfg80211/mac80211: separate link params from station params") Signed-off-by: Mikhail Lobanov <m.lobanov@rosa.ru> Link: https://patch.msgid.link/20250317103139.17625-1-m.lobanov@rosa.ru Signed-off-by: Johannes Berg <johannes.berg@intel.com> [ 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. ] Signed-off-by: Hanne-Lotta Mäenpää <hannelotta@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 82ef97a commit e442a96

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

net/mac80211/cfg.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,12 +1658,13 @@ static int sta_apply_parameters(struct ieee80211_local *local,
16581658
return ret;
16591659
}
16601660

1661-
if (params->supported_rates && params->supported_rates_len) {
1662-
ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef,
1663-
sband, params->supported_rates,
1664-
params->supported_rates_len,
1665-
&sta->sta.supp_rates[sband->band]);
1666-
}
1661+
if (params->supported_rates &&
1662+
params->supported_rates_len &&
1663+
!ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef,
1664+
sband, params->supported_rates,
1665+
params->supported_rates_len,
1666+
&sta->sta.supp_rates[sband->band]))
1667+
return -EINVAL;
16671668

16681669
if (params->ht_capa)
16691670
ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,

0 commit comments

Comments
 (0)