Re: [PATCH wireless-next] wifi: mac80211: reject VHT opmode for unsupported channel widths
From: Johannes Berg
Date: Thu Jul 03 2025 - 12:54:27 EST
On Thu, 2025-07-03 at 09:35 -0700, Moonhee Lee wrote:
>
> To address this, I plan to reject the set of channel widths that are not valid
> with VHT opmode. This includes all channel widths below 20 MHz, as well as
> 20 MHz without HT (20_NOHT), which is also incompatible.
>
> Would the following logic for v2 be acceptable?
>
> /* reject channel widths not valid with VHT opmode */
> switch (width) {
> case NL80211_CHAN_WIDTH_5:
> case NL80211_CHAN_WIDTH_10:
> case NL80211_CHAN_WIDTH_1:
> case NL80211_CHAN_WIDTH_2:
> case NL80211_CHAN_WIDTH_4:
> case NL80211_CHAN_WIDTH_8:
> case NL80211_CHAN_WIDTH_16:
> case NL80211_CHAN_WIDTH_20_NOHT:
> return -EINVAL;
> default:
> break;
> }
>
> This allows valid HT/VHT channel widths, including 20, 40, 80, 80+80, 160, and
> 320, to pass through while filtering out values that would otherwise trigger a
> WARN_ON.
I think it'd make more sense to go the other way around and list the
bandwidths that are _valid_ here, even if I don't see it getting
extended any time soon (anyone working on TVHT? ;-) )
But in some way I also have a feeling we _should_ be able to reject this
in cfg80211 already - although it seems that right now we cannot. Hmm. I
guess better to have this validation here now than fail/WARN, but then
I'd like a positive list of allowed values, rather than forbidden ones.
johannes