From: m.limarencko@yandex.ru
To: jjohnson@kernel.org
Cc: linux-wireless@vger.kernel.org, ath12k@lists.infradead.org,
linux-kernel@vger.kernel.org,
Mikhail Limarenko <m.limarencko@yandex.ru>
Subject: [PATCH ath-next 3/4] wifi: ath12k: sanitize invalid MCS metadata in rx path
Date: Mon, 9 Feb 2026 06:02:42 +0300 [thread overview]
Message-ID: <20260209030243.1530075-4-m.limarencko@yandex.ru> (raw)
In-Reply-To: <20260209030243.1530075-1-m.limarencko@yandex.ru>
From: Mikhail Limarenko <m.limarencko@yandex.ru>
Malformed or unsupported rate metadata from firmware can carry
invalid MCS values into mac80211 status handling.
This was observed with HE MCS=12 and coincided with
ieee80211_rx_list warnings.
When MCS is out of range, fall back to legacy metadata and use
ratelimited diagnostics.
Tested-on: QCNFA765 (WCN785x), kernel 6.18.5+deb13-amd64
Signed-off-by: Mikhail Limarenko <m.limarencko@yandex.ru>
---
drivers/net/wireless/ath/ath12k/dp_rx.c | 39 +++++++++++++++----------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index 99d29ed..f0c56a9 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -2534,9 +2534,11 @@ static void ath12k_dp_rx_h_rate(struct ath12k *ar, struct ath12k_dp_rx_info *rx_
case RX_MSDU_START_PKT_TYPE_11N:
rx_status->encoding = RX_ENC_HT;
if (rate_mcs > ATH12K_HT_MCS_MAX) {
- ath12k_warn(ar->ab,
- "Received with invalid mcs in HT mode %d\n",
- rate_mcs);
+ dev_warn_ratelimited(ar->ab->dev,
+ "ath12k: invalid HT mcs %u, forcing legacy rate metadata\n",
+ rate_mcs);
+ rx_status->encoding = RX_ENC_LEGACY;
+ rx_status->rate_idx = 0;
break;
}
rx_status->rate_idx = rate_mcs + (8 * (nss - 1));
@@ -2546,42 +2548,47 @@ static void ath12k_dp_rx_h_rate(struct ath12k *ar, struct ath12k_dp_rx_info *rx_
break;
case RX_MSDU_START_PKT_TYPE_11AC:
rx_status->encoding = RX_ENC_VHT;
- rx_status->rate_idx = rate_mcs;
if (rate_mcs > ATH12K_VHT_MCS_MAX) {
- ath12k_warn(ar->ab,
- "Received with invalid mcs in VHT mode %d\n",
- rate_mcs);
+ dev_warn_ratelimited(ar->ab->dev,
+ "ath12k: invalid VHT mcs %u, forcing legacy rate metadata\n",
+ rate_mcs);
+ rx_status->encoding = RX_ENC_LEGACY;
+ rx_status->rate_idx = 0;
break;
}
+ rx_status->rate_idx = rate_mcs;
rx_status->nss = nss;
if (sgi)
rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI;
rx_status->bw = ath12k_mac_bw_to_mac80211_bw(bw);
break;
case RX_MSDU_START_PKT_TYPE_11AX:
- rx_status->rate_idx = rate_mcs;
if (rate_mcs > ATH12K_HE_MCS_MAX) {
- ath12k_warn(ar->ab,
- "Received with invalid mcs in HE mode %d\n",
- rate_mcs);
+ dev_warn_ratelimited(ar->ab->dev,
+ "ath12k: invalid HE mcs %u, forcing legacy rate metadata\n",
+ rate_mcs);
+ rx_status->encoding = RX_ENC_LEGACY;
+ rx_status->rate_idx = 0;
break;
}
rx_status->encoding = RX_ENC_HE;
+ rx_status->rate_idx = rate_mcs;
rx_status->nss = nss;
rx_status->he_gi = ath12k_he_gi_to_nl80211_he_gi(sgi);
rx_status->bw = ath12k_mac_bw_to_mac80211_bw(bw);
break;
case RX_MSDU_START_PKT_TYPE_11BE:
- rx_status->rate_idx = rate_mcs;
-
if (rate_mcs > ATH12K_EHT_MCS_MAX) {
- ath12k_warn(ar->ab,
- "Received with invalid mcs in EHT mode %d\n",
- rate_mcs);
+ dev_warn_ratelimited(ar->ab->dev,
+ "ath12k: invalid EHT mcs %u, forcing legacy rate metadata\n",
+ rate_mcs);
+ rx_status->encoding = RX_ENC_LEGACY;
+ rx_status->rate_idx = 0;
break;
}
rx_status->encoding = RX_ENC_EHT;
+ rx_status->rate_idx = rate_mcs;
rx_status->nss = nss;
rx_status->eht.gi = ath12k_mac_eht_gi_to_nl80211_eht_gi(sgi);
rx_status->bw = ath12k_mac_bw_to_mac80211_bw(bw);
--
2.47.3
next prev parent reply other threads:[~2026-02-09 3:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 3:02 [PATCH ath-next 0/4] wifi: ath12k: harden stats/rate handling for WCN785x stability m.limarencko
2026-02-09 3:02 ` [PATCH ath-next 1/4] wifi: ath12k: validate survey index when frequency is not found m.limarencko
2026-02-10 3:37 ` Baochen Qiang
[not found] ` <1277331770898332@mail.yandex.ru>
2026-02-12 16:47 ` Jeff Johnson
2026-02-09 3:02 ` [PATCH ath-next 2/4] wifi: ath12k: avoid long fw_stats waits on vdev stats hot path m.limarencko
2026-02-10 5:31 ` Baochen Qiang
2026-02-09 3:02 ` m.limarencko [this message]
2026-02-09 3:02 ` [PATCH ath-next 4/4] wifi: ath12k: sanitize invalid MCS metadata in monitor rx path m.limarencko
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=20260209030243.1530075-4-m.limarencko@yandex.ru \
--to=m.limarencko@yandex.ru \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®