From: meihaipeng <meihaipeng@uniontech.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Andrei Otcheretianski <andrei.otcheretianski@intel.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
meihaipeng <meihaipeng@uniontech.com>,
syzbot+c0472dd80bb8f668625f@syzkaller.appspotmail.com
Subject: [PATCH] wifi: mac80211_hwsim: handle 5/10 MHz chanctx in rc update
Date: Fri, 29 May 2026 12:09:23 +0800 [thread overview]
Message-ID: <20260529040923.9816-1-meihaipeng@uniontech.com> (raw)
mac80211_hwsim_sta_rc_update() compares ieee80211_sta_rx_bandwidth against
the current channel context width.
The STA bandwidth enum has no sub-20 MHz states, so a normal 20 MHz link
STA falsely trips the warning on 5/10 MHz OCB channel contexts.so
a normal 20 MHz link STA falsely trips the warning on 5/10 MHz OCB
channel contexts.
Treat sub-20 MHz channel contexts as 20 MHz for this validation and use
the actual channel-context width in the warning message.
Fixes: aea9a6088ae46 ("wifi: mac80211_hwsim: do rc update per link")
Reported-by: syzbot+c0472dd80bb8f668625f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c0472dd80bb8f668625f
Signed-off-by: meihaipeng <meihaipeng@uniontech.com>
---
drivers/net/wireless/virtual/mac80211_hwsim.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index 1fcf5d0d2e13..3d759fb328a8 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -2793,6 +2793,7 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,
for (link_id = 0;
link_id < ARRAY_SIZE(vif->link_conf);
link_id++) {
+ u32 confbw_mhz = 20;
enum nl80211_chan_width confbw = NL80211_CHAN_WIDTH_20_NOHT;
struct ieee80211_bss_conf *vif_conf;
@@ -2826,10 +2827,17 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,
confbw = chanctx_conf->def.width;
}
- WARN(bw > hwsim_get_chanwidth(confbw),
+ /*
+ * ieee80211_sta_rx_bandwidth does not represent sub-20 MHz
+ * channels, so treat 5/10 MHz channel contexts as 20 MHz when
+ * validating the link bandwidth.
+ */
+ confbw_mhz = max_t(u32, confbw_mhz, hwsim_get_chanwidth(confbw));
+
+ WARN(bw > confbw_mhz,
"intf %pM [link=%d]: bad STA %pM bandwidth %d MHz (%d) > channel config %d MHz (%d)\n",
vif->addr, link_id, sta->addr, bw, sta->deflink.bandwidth,
- hwsim_get_chanwidth(data->bw), data->bw);
+ hwsim_get_chanwidth(confbw), confbw);
}
--
2.20.1
next reply other threads:[~2026-05-29 4:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 4:09 meihaipeng [this message]
2026-05-29 5:10 ` [PATCH] wifi: mac80211_hwsim: handle 5/10 MHz chanctx in rc update Lachlan Hodges
2026-05-29 6:20 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260529040923.9816-1-meihaipeng@uniontech.com \
--to=meihaipeng@uniontech.com \
--cc=andrei.otcheretianski@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=syzbot+c0472dd80bb8f668625f@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox