Skip to content

Commit ce04abc

Browse files
committed
wifi: mac80211: check basic rates validity
When userspace sets basic rates, it might send us some rates list that's empty or consists of invalid values only. We're currently ignoring invalid values and then may end up with a rates bitmap that's empty, which later results in a warning. Reject the call if there were no valid rates. Signed-off-by: Johannes Berg <[email protected]>
1 parent b27f07c commit ce04abc

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

net/mac80211/cfg.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,6 +2611,17 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
26112611
if (!sband)
26122612
return -EINVAL;
26132613

2614+
if (params->basic_rates) {
2615+
if (!ieee80211_parse_bitrates(link->conf->chandef.width,
2616+
wiphy->bands[sband->band],
2617+
params->basic_rates,
2618+
params->basic_rates_len,
2619+
&link->conf->basic_rates))
2620+
return -EINVAL;
2621+
changed |= BSS_CHANGED_BASIC_RATES;
2622+
ieee80211_check_rate_mask(link);
2623+
}
2624+
26142625
if (params->use_cts_prot >= 0) {
26152626
link->conf->use_cts_prot = params->use_cts_prot;
26162627
changed |= BSS_CHANGED_ERP_CTS_PROT;
@@ -2632,16 +2643,6 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
26322643
changed |= BSS_CHANGED_ERP_SLOT;
26332644
}
26342645

2635-
if (params->basic_rates) {
2636-
ieee80211_parse_bitrates(link->conf->chandef.width,
2637-
wiphy->bands[sband->band],
2638-
params->basic_rates,
2639-
params->basic_rates_len,
2640-
&link->conf->basic_rates);
2641-
changed |= BSS_CHANGED_BASIC_RATES;
2642-
ieee80211_check_rate_mask(link);
2643-
}
2644-
26452646
if (params->ap_isolate >= 0) {
26462647
if (params->ap_isolate)
26472648
sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;

0 commit comments

Comments
 (0)