Skip to content

Commit 16ee3ea

Browse files
Mikhail Lobanovjmberg-intel
authored andcommitted
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 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>
1 parent 892726f commit 16ee3ea

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

net/mac80211/cfg.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,12 +1907,12 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,
19071907
}
19081908

19091909
if (params->supported_rates &&
1910-
params->supported_rates_len) {
1911-
ieee80211_parse_bitrates(link->conf->chanreq.oper.width,
1912-
sband, params->supported_rates,
1913-
params->supported_rates_len,
1914-
&link_sta->pub->supp_rates[sband->band]);
1915-
}
1910+
params->supported_rates_len &&
1911+
!ieee80211_parse_bitrates(link->conf->chanreq.oper.width,
1912+
sband, params->supported_rates,
1913+
params->supported_rates_len,
1914+
&link_sta->pub->supp_rates[sband->band]))
1915+
return -EINVAL;
19161916

19171917
if (params->ht_capa)
19181918
ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,

0 commit comments

Comments
 (0)