[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240727125033.1774143-1-vincenzo.mezzela@gmail.com>
Date: Sat, 27 Jul 2024 14:50:33 +0200
From: Vincenzo Mezzela <vincenzo.mezzela@...il.com>
To: johannes@...solutions.net,
sashal@...nel.org,
gregkh@...uxfoundation.org
Cc: linux-wireless@...r.kernel.org,
netdev@...r.kernel.org,
javier.carrasco.cruz@...il.com,
skhan@...uxfoundation.org,
stable@...r.kernel.org,
Johannes Berg <johannes.berg@...el.com>,
syzbot+19013115c9786bfd0c4e@...kaller.appspotmail.com,
Vincenzo Mezzela <vincenzo.mezzela@...il.com>
Subject: [PATCH v5.15] wifi: mac80211: check basic rates validity
From: Johannes Berg <johannes.berg@...el.com>
commit ce04abc3fcc62cd5640af981ebfd7c4dc3bded28 upstream.
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.
[ Conflict resolution involved adjusting the patch to accommodate
changes in the function signature of ieee80211_parse_bitrates,
specifically the updated first parameter ]
Signed-off-by: Johannes Berg <johannes.berg@...el.com>
Reported-by: syzbot+19013115c9786bfd0c4e@...kaller.appspotmail.com
Tested-by: syzbot+19013115c9786bfd0c4e@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=19013115c9786bfd0c4e
Signed-off-by: Vincenzo Mezzela <vincenzo.mezzela@...il.com>
---
net/mac80211/cfg.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f277ce839ddb..85abd3ff07b4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2339,6 +2339,17 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
if (!sband)
return -EINVAL;
+ if (params->basic_rates) {
+ if (!ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef,
+ wiphy->bands[sband->band],
+ params->basic_rates,
+ params->basic_rates_len,
+ &sdata->vif.bss_conf.basic_rates))
+ return -EINVAL;
+ changed |= BSS_CHANGED_BASIC_RATES;
+ ieee80211_check_rate_mask(sdata);
+ }
+
if (params->use_cts_prot >= 0) {
sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot;
changed |= BSS_CHANGED_ERP_CTS_PROT;
@@ -2362,16 +2373,6 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
changed |= BSS_CHANGED_ERP_SLOT;
}
- if (params->basic_rates) {
- ieee80211_parse_bitrates(&sdata->vif.bss_conf.chandef,
- wiphy->bands[sband->band],
- params->basic_rates,
- params->basic_rates_len,
- &sdata->vif.bss_conf.basic_rates);
- changed |= BSS_CHANGED_BASIC_RATES;
- ieee80211_check_rate_mask(sdata);
- }
-
if (params->ap_isolate >= 0) {
if (params->ap_isolate)
sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS;
--
2.43.0
Powered by blists - more mailing lists