From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Saikiran <bjsaikiran@gmail.com>, ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, kvalo@kernel.org
Subject: Re: [PATCH] wifi: ath12k: Fix invalid frequency error in freq_to_idx
Date: Mon, 26 Jan 2026 11:38:49 +0800 [thread overview]
Message-ID: <23eef2f9-51da-4136-af54-d48e0d652c2e@oss.qualcomm.com> (raw)
In-Reply-To: <20260123155750.6007-6-bjsaikiran@gmail.com>
On 1/23/2026 11:57 PM, Saikiran wrote:
> During suspend/resume, the following error is observed in dmesg:
> ath12k_pci 0004:01:00.0: chan info: invalid frequency <freq> (idx 101 out of bounds)
>
> This occurs because freq_to_idx() incorrectly filters channels based on
> ar->freq_range.start_freq and ar->freq_range.end_freq. These values can be
> temporarily zeroed out (e.g., during regulatory updates or suspend/resume
> sequences) while the hardware is still operational or reporting status.
>
> When these values are zero, the filter skips all valid channels, causing
> the function to return the total channel count (e.g. 101) instead of the
> actual index, triggering the out-of-bounds warning.
>
> Remove the broken frequency range filtering from freq_to_idx(). Channel
> mapping should depend only on the hardware band definition, not on the
> transient regulatory frequency range. This mirrors the fix recently applied
> to ath12k_reg_update_chan_list().
>
> Tested-on: Lenovo Yoga Slim 7x
>
> Signed-off-by: Saikiran <bjsaikiran@gmail.com>
> ---
> drivers/net/wireless/ath/ath12k/wmi.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
> index be8b2943094f..bef1b324b62c 100644
> --- a/drivers/net/wireless/ath/ath12k/wmi.c
> +++ b/drivers/net/wireless/ath/ath12k/wmi.c
> @@ -6576,11 +6576,7 @@ static int freq_to_idx(struct ath12k *ar, int freq)
> continue;
>
> for (ch = 0; ch < sband->n_channels; ch++, idx++) {
> - if (sband->channels[ch].center_freq <
> - KHZ_TO_MHZ(ar->freq_range.start_freq) ||
> - sband->channels[ch].center_freq >
> - KHZ_TO_MHZ(ar->freq_range.end_freq))
> - continue;
> +
>
> if (sband->channels[ch].center_freq == freq)
> goto exit;
this has been fixed upstream, though for a different issue.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1fed08c5519d2f929457f354d3c06c6a8c33829c
prev parent reply other threads:[~2026-01-26 3:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 15:57 [PATCH 0/5] wifi: ath12k: Fix 5 GHz Wi-Fi regression on WCN7850 Saikiran
2026-01-23 15:57 ` [PATCH] wifi: ath12k: Fix firmware stats leak on get_txpower error paths Saikiran
2026-01-26 5:22 ` Baochen Qiang
2026-01-23 15:57 ` [PATCH] wifi: ath12k: Initialize regulatory frequency ranges to avoid filtering all channels Saikiran
2026-01-26 5:26 ` Baochen Qiang
2026-01-23 15:57 ` [PATCH] wifi: ath12k: Add fallback regulatory domain for WCN7850 without SMBIOS Saikiran
2026-01-23 15:57 ` [PATCH] wifi: ath12k: Remove broken frequency range filtering Saikiran
2026-01-26 5:45 ` Baochen Qiang
[not found] ` <CAAFDt1syi0jLvrho4mnvwsv8HtraT78wP8tCLFHRw3oiTq2E5w@mail.gmail.com>
2026-01-26 6:51 ` Baochen Qiang
[not found] ` <CAAFDt1v-CBHPTMHQB2B9o3X547agCj77RF9tpp_sgUAPkUaYSw@mail.gmail.com>
2026-01-26 8:28 ` Saikiran B
2026-01-23 15:57 ` [PATCH] wifi: ath12k: Fix invalid frequency error in freq_to_idx Saikiran
2026-01-26 3:38 ` Baochen Qiang [this message]
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=23eef2f9-51da-4136-af54-d48e0d652c2e@oss.qualcomm.com \
--to=baochen.qiang@oss.qualcomm.com \
--cc=ath12k@lists.infradead.org \
--cc=bjsaikiran@gmail.com \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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