The frequencies returned by cfg80211_s1g_get_{start/end}_freq_khz() for 1MHz chandefs are off by +-1000KHz. This prevents some 1MHz channels from being used as the range returned is larger leading to adjacent 1MHz channels being included in the validation process. Channels on the band edge may be prevented from being used if any of those extra channels are disabled / no primary etc. To fix return the center frequency as 1MHz channels don't contain any subchannels. Fixes: d0688dc2b172 ("wifi: cfg80211: correctly implement and validate S1G chandef") Signed-off-by: Lachlan Hodges --- include/net/cfg80211.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 781624f5913a..a1e362e0054d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -10194,7 +10194,8 @@ cfg80211_s1g_get_start_freq_khz(const struct cfg80211_chan_def *chandef) u32 bw_mhz = cfg80211_chandef_get_width(chandef); u32 center_khz = MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; - return center_khz - bw_mhz * 500 + 500; + + return (bw_mhz == 1) ? center_khz : center_khz - bw_mhz * 500 + 500; } /** @@ -10209,7 +10210,8 @@ cfg80211_s1g_get_end_freq_khz(const struct cfg80211_chan_def *chandef) u32 bw_mhz = cfg80211_chandef_get_width(chandef); u32 center_khz = MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset; - return center_khz + bw_mhz * 500 - 500; + + return (bw_mhz == 1) ? center_khz : center_khz + bw_mhz * 500 - 500; } /** -- 2.43.0