From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Ping-Ke Shih <pkshih@realtek.com>,
Sasha Levin <sashal@kernel.org>,
linux-wireless@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: pci: validate release report content before using for RTL8922DE
Date: Sat, 14 Feb 2026 16:23:54 -0500 [thread overview]
Message-ID: <20260214212452.782265-89-sashal@kernel.org> (raw)
In-Reply-To: <20260214212452.782265-1-sashal@kernel.org>
From: Ping-Ke Shih <pkshih@realtek.com>
[ Upstream commit 5f93d611b33a05bd03d6843c8efe8cb6a1992620 ]
The commit 957eda596c76
("wifi: rtw89: pci: validate sequence number of TX release report")
does validation on existing chips, which somehow a release report of SKB
becomes malformed. As no clear cause found, add rules ahead for RTL8922DE
to avoid crash if it happens.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260123013957.16418-11-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
### Detailed Code Change Analysis
The change modifies the `rtw89_pci_release_rpp()` function in two ways:
**OLD code:**
```c
if (unlikely(rpp_info.txch == RTW89_TXCH_CH12)) {
rtw89_warn(rtwdev, "should no fwcmd release report\n");
return;
}
```
**NEW code:**
```c
if (unlikely(rpp_info.txch >= RTW89_TXCH_NUM ||
info->tx_dma_ch_mask & BIT(rpp_info.txch))) {
rtw89_warn(rtwdev, "should no release report on txch %d\n",
rpp_info.txch);
return;
}
```
**What changed and why it matters:**
1. **Bounds check strengthened**: The old check only rejected `txch ==
RTW89_TXCH_CH12` (value 12). The new check rejects `txch >=
RTW89_TXCH_NUM` (value >= 13), which catches **out-of-bounds array
access** when `rpp_info.txch` is used as an index into
`rtwpci->tx.rings[]` (which has `RTW89_TXCH_NUM` = 13 elements).
Without this check, a malformed report with `txch >= 13` would cause
an **out-of-bounds array access**, potentially leading to a crash.
2. **Masked channel check added**: The new code also checks
`info->tx_dma_ch_mask & BIT(rpp_info.txch)`, which rejects release
reports for TX channels that are disabled/masked on the specific
hardware. Accessing a ring for a masked channel could reference
uninitialized data since those rings are not set up during
initialization (as confirmed by the `tx_dma_ch_mask` being used to
skip ring initialization).
3. **The old CH12 check is subsumed**: RTW89_TXCH_CH12 = 12 is the
firmware command channel. For chips like RTL8922DE, `tx_dma_ch_mask`
includes `BIT(RTW89_TXCH_CH12)` (since FW CMD channel is typically
masked), so the old specific check is generalized into the broader
mask-based check.
### 3. CLASSIFICATION
This is a **bug fix** — specifically a crash prevention fix through
input validation. It:
- Prevents out-of-bounds array access (txch >= RTW89_TXCH_NUM)
- Prevents access to uninitialized TX rings (masked channels)
- The commit message explicitly says "to avoid crash if it happens"
- This extends existing validation (from commit 957eda596c76) to cover
additional edge cases for RTL8922DE
### 4. SCOPE AND RISK ASSESSMENT
- **Lines changed**: ~6 lines modified in a single function
- **Files touched**: 1 file (`drivers/net/wireless/realtek/rtw89/pci.c`)
- **Risk**: Very low. The change only adds/strengthens a bounds check
and an already-masked-channel check. It's purely defensive — it only
triggers on malformed data and returns early with a warning.
- **Subsystem**: WiFi driver (rtw89), well-maintained by Realtek
engineers
- **The old behavior (CH12 check) is subsumed**, not removed — it's
generalized
### 5. USER IMPACT
- **Who is affected**: Users with RTL8922DE WiFi adapters (and
potentially other Realtek WiFi chips using the rtw89 driver)
- **Severity if triggered**: Kernel crash (NULL pointer dereference or
out-of-bounds access) — this is HIGH severity
- **Likelihood**: The referenced commit 957eda596c76 was created because
this actually happened with malformed release reports — the cause was
unclear but the crash was real
- **Author**: Ping-Ke Shih from Realtek, the driver maintainer — high
trust
### 6. STABILITY INDICATORS
- The commit comes from the rtw89 maintainer at Realtek
- It follows the pattern of an earlier validated fix (957eda596c76)
- Small, surgical change with clear defensive purpose
### 7. DEPENDENCY CHECK
- This commit depends on `957eda596c76` being present (which added the
initial validation framework including the `rpp_info.seq >=
RTW89_PCI_TXWD_NUM_MAX` check that remains unchanged)
- It also depends on the `tx_dma_ch_mask` field existing in `struct
rtw89_pci_info` and the `parse_rpp` callback mechanism
- The RTL8922DE support needs to exist in the target stable tree
### Summary
This is a small, surgical crash prevention fix that strengthens input
validation for malformed TX release reports in the rtw89 WiFi driver. It
prevents:
1. **Out-of-bounds array access** when `txch >= RTW89_TXCH_NUM` (13)
2. **Access to uninitialized/disabled TX rings** when the channel is
masked
The fix is:
- Obviously correct (bounds check + mask check before array indexing)
- Small and contained (6 lines in one function, one file)
- Fixes a real crash scenario (explicitly stated, and mirrors existing
fix for other chips)
- Written by the driver maintainer at Realtek
- Very low regression risk (only affects error/malformed paths)
The only concern is whether the RTL8922DE support and the prerequisite
commit exist in the target stable tree. If the RTL8922DE driver and the
`tx_dma_ch_mask` infrastructure are present, this is straightforward to
backport.
**YES**
drivers/net/wireless/realtek/rtw89/pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c
index 093960d7279f8..b8135cf15d13c 100644
--- a/drivers/net/wireless/realtek/rtw89/pci.c
+++ b/drivers/net/wireless/realtek/rtw89/pci.c
@@ -604,8 +604,10 @@ static void rtw89_pci_release_rpp(struct rtw89_dev *rtwdev, void *rpp)
info->parse_rpp(rtwdev, rpp, &rpp_info);
- if (unlikely(rpp_info.txch == RTW89_TXCH_CH12)) {
- rtw89_warn(rtwdev, "should no fwcmd release report\n");
+ if (unlikely(rpp_info.txch >= RTW89_TXCH_NUM ||
+ info->tx_dma_ch_mask & BIT(rpp_info.txch))) {
+ rtw89_warn(rtwdev, "should no release report on txch %d\n",
+ rpp_info.txch);
return;
}
--
2.51.0
next prev parent reply other threads:[~2026-02-14 21:27 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 21:22 [PATCH AUTOSEL 6.19-6.12] wifi: rtw89: ser: enable error IMR after recovering from L1 Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] wifi: ath11k: Fix failure to connect to a 6 GHz AP Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.1] wifi: rtw88: 8822b: Avoid WARNING in rtw8822b_config_trx_mode() Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw89: 8922a: add digital compensation for 2GHz Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: pci: validate sequence number of TX release report Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-5.10] wifi: iwlegacy: add missing mutex protection in il4965_store_tx_power() Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.6] wifi: rtw88: rtw8821cu: Add ID for Mercusys MU6H Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: Add support for MSI AX1800 Nano (GUAX18N) Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: mcc: reset probe counter when receiving beacon Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: setting TBTT AGG number when mac port initialization Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: disable EHT protocol by chip capabilities Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-5.10] wifi: ath10k: fix lock protection in ath10k_wmi_event_peer_sta_ps_state_chg() Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] wifi: cfg80211: allow only one NAN interface, also in multi radio Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.6] wifi: ath12k: fix preferred hardware mode calculation Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.1] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero Sasha Levin
2026-02-14 21:22 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw89: mac: correct page number for CSI response Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw88: Fix inadvertent sharing of struct ieee80211_supported_band data Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19] wifi: rtw89: 8852au: add support for TP TX30U Plus Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.6] wifi: ath11k: add pm quirk for Thinkpad Z13/Z16 Gen1 Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19] wifi: rtw89: Add default ID 28de:2432 for RTL8832CU Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.18] wifi: ath12k: fix mac phy capability parsing Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.1] wifi: rtw89: pci: restore LDO setting after device resume Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] wifi: iwlegacy: add missing mutex protection in il3945_store_measurement() Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19] wifi: rtw89: Add support for D-Link VR Air Bridge (DWA-F18) Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.6] wifi: rtw89: wow: add reason codes for disassociation in WoWLAN mode Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw89: fix unable to receive probe responses under MLO connection Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: regd: 6 GHz power type marks default when inactive Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19] wifi: cfg80211: treat deprecated INDOOR_SP_AP_OLD control value as LPI mode Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw88: Use devm_kmemdup() in rtw_set_supported_band() Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-5.10] wifi: libertas: fix WARNING in usb_tx_block Sasha Levin
2026-02-14 21:23 ` Sasha Levin [this message]
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.12] wifi: rtw89: 8922a: set random mac if efuse contains zeroes Sasha Levin
2026-02-14 21:23 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: fix potential zero beacon interval in beacon tracking Sasha Levin
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=20260214212452.782265-89-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=pkshih@realtek.com \
--cc=stable@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