From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Zong-Zhe Yang <kevin_yang@realtek.com>,
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: regd: 6 GHz power type marks default when inactive
Date: Sat, 14 Feb 2026 16:23:35 -0500 [thread overview]
Message-ID: <20260214212452.782265-70-sashal@kernel.org> (raw)
In-Reply-To: <20260214212452.782265-1-sashal@kernel.org>
From: Zong-Zhe Yang <kevin_yang@realtek.com>
[ Upstream commit 8c96752d99c0b094af68317a8c701b09bd0862d9 ]
When inactive, 6 GHz power type has been assigned to the default one,
but missed to mark the local control variable, dflt, true. Then, this
might let some 6 GHz power info of disconnected APs keep being taken
into account under certain cases.
So, mark default when inactive.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251229030926.27004-12-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Commit Analysis: wifi: rtw89: regd: 6 GHz power type marks default
when inactive
### 1. Commit Message Analysis
The commit message clearly describes a bug: when a 6 GHz connection
becomes inactive, the code correctly sets the power type to the default
value (`RTW89_REG_6GHZ_POWER_DFLT`), but **fails to set the local
variable `dflt = true`**. This is a logic error where two related state
updates are out of sync.
The consequence: "this might let some 6 GHz power info of disconnected
APs keep being taken into account under certain cases." This means stale
power configuration from a previously connected AP could persist and
affect regulatory behavior.
### 2. Code Change Analysis
The fix is a **single line addition**: `dflt = true;` in the `else`
(inactive) branch.
Let me trace the logic:
- `dflt` is a boolean that tracks whether the default power type is in
use
- In the `active` branch, when the `default:` case of the switch is hit,
both `reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT` AND `dflt = true`
are set
- In the `else` (inactive) branch, `reg_6ghz_power =
RTW89_REG_6GHZ_POWER_DFLT` is set but `dflt` was **not** being set to
`true`
The `dflt` variable is then checked at line `if (!dflt &&
blocked[rtwvif_link->reg_6ghz_power])`. When `dflt` is false and the
power type is `RTW89_REG_6GHZ_POWER_DFLT`, the code would incorrectly
check `blocked[RTW89_REG_6GHZ_POWER_DFLT]`, which could cause the
function to return `-EINVAL` erroneously when the link is inactive, or
it could allow stale power type information to persist.
### 3. Bug Classification
This is a **logic bug** — specifically a missing state update that
causes inconsistent behavior. When a WiFi interface goes inactive on 6
GHz:
- The power type is correctly reset to default
- But `dflt` stays false (from initialization), so the "blocked" check
below could still evaluate the default power type against the blocked
list, potentially returning an error when it shouldn't
This affects regulatory domain handling, which is important for proper
WiFi operation on 6 GHz bands.
### 4. Scope and Risk Assessment
- **Size**: 1 line added — minimal
- **Files touched**: 1 file
(`drivers/net/wireless/realtek/rtw89/regd.c`)
- **Risk**: Extremely low — it's adding a missing boolean assignment
that mirrors the behavior already present in the `default:` case of
the `active` branch
- **Correctness**: Obviously correct — the inactive branch sets the same
`RTW89_REG_6GHZ_POWER_DFLT` value as the default case in the active
branch, so it should also set `dflt = true`
### 5. User Impact
- Affects users of Realtek RTW89 WiFi adapters using 6 GHz bands
- Could cause incorrect regulatory power type handling when
disconnecting from 6 GHz APs
- In certain cases, stale power info from disconnected APs could be
used, potentially causing regulatory compliance issues or connectivity
problems
### 6. Stable Kernel Criteria
- **Obviously correct**: Yes — the fix is symmetric with the `default:`
case in the active branch
- **Fixes a real bug**: Yes — logic error causing inconsistent state
- **Small and contained**: Yes — 1 line in 1 file
- **No new features**: Correct — pure bug fix
- **Tested**: From Realtek maintainers (Zong-Zhe Yang, Ping-Ke Shih)
### 7. Dependencies
This fix is self-contained. The surrounding code structure (the switch
statement, the `dflt` variable, the `blocked[]` check) all exist in
stable kernels that have the rtw89 driver with 6 GHz support.
### Conclusion
This is a clean, minimal, obviously-correct bug fix that addresses a
real logic error in WiFi regulatory power type handling. It has
negligible risk of regression and fixes a genuine issue for users of
Realtek WiFi adapters on 6 GHz networks.
**YES**
drivers/net/wireless/realtek/rtw89/regd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c
index 209d84909f885..c3425ed44732e 100644
--- a/drivers/net/wireless/realtek/rtw89/regd.c
+++ b/drivers/net/wireless/realtek/rtw89/regd.c
@@ -1142,6 +1142,7 @@ static int rtw89_reg_6ghz_power_recalc(struct rtw89_dev *rtwdev,
}
} else {
rtwvif_link->reg_6ghz_power = RTW89_REG_6GHZ_POWER_DFLT;
+ dflt = true;
}
rcu_read_unlock();
--
2.51.0
next prev parent reply other threads:[~2026-02-14 21:26 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 ` Sasha Levin [this message]
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 ` [PATCH AUTOSEL 6.19-6.18] wifi: rtw89: pci: validate release report content before using for RTL8922DE Sasha Levin
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-70-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kevin_yang@realtek.com \
--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