* [PATCH 1/5] wifi: ath11k: validate DMA buffer release TLV lengths
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
@ 2026-10-28 5:12 ` Jiale Yao
2026-10-28 5:12 ` [PATCH 2/5] wifi: ath11k: validate hardware mode capability TLVs Jiale Yao
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jiale Yao @ 2026-10-28 5:12 UTC (permalink / raw)
To: Jeff Johnson, Kalle Valo, Karthikeyan Periyasamy, linux-wireless,
ath11k, linux-kernel
Cc: stable
The DMA buffer release parser counts nested entry and metadata TLVs, but
does not ensure their payloads cover the structures later indexed by
the direct buffer ring handler. Short firmware TLVs can therefore lead
to out-of-bounds reads when the arrays are consumed.
Add minimum-length policies for both nested TLV types.
Fixes: 9d11b7bff950 ("ath11k: add support for spectral scan")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/ath/ath11k/wmi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 08fd6795ed9e..0d4481a09501 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -161,6 +161,10 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_p2p_noa_event) },
[WMI_TAG_PDEV_CSA_SWITCH_COUNT_STATUS_EVENT] = {
.min_len = sizeof(struct wmi_pdev_csa_switch_ev) },
+ [WMI_TAG_DMA_BUF_RELEASE_ENTRY] = {
+ .min_len = sizeof(struct wmi_dma_buf_release_entry) - TLV_HDR_SIZE },
+ [WMI_TAG_DMA_BUF_RELEASE_SPECTRAL_META_DATA] = {
+ .min_len = sizeof(struct wmi_dma_buf_release_meta_data) - TLV_HDR_SIZE },
};
#define PRIMAP(_hw_mode_) \
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/5] wifi: ath11k: validate hardware mode capability TLVs
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
2026-10-28 5:12 ` [PATCH 1/5] wifi: ath11k: validate DMA buffer release " Jiale Yao
@ 2026-10-28 5:12 ` Jiale Yao
2026-10-28 5:12 ` [PATCH 3/5] wifi: ath11k: validate DMA ring " Jiale Yao
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jiale Yao @ 2026-10-28 5:12 UTC (permalink / raw)
To: Jeff Johnson, Govindaraj Saminathan, Maharaja Kennadyrajan,
Rajkumar Manoharan, Sven Eckelmann, Sriram R, linux-wireless,
ath11k, linux-kernel
Cc: stable
The service-ready parser indexes hardware mode capability TLVs using the
full structure stride and reads their PHY maps without validating the
firmware-declared payload length. A short TLV can therefore cause an
out-of-bounds read.
Add a minimum-length policy for hardware mode capability TLVs.
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/ath/ath11k/wmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 0d4481a09501..8a73318704f3 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -165,6 +165,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_dma_buf_release_entry) - TLV_HDR_SIZE },
[WMI_TAG_DMA_BUF_RELEASE_SPECTRAL_META_DATA] = {
.min_len = sizeof(struct wmi_dma_buf_release_meta_data) - TLV_HDR_SIZE },
+ [WMI_TAG_HW_MODE_CAPABILITIES] = {
+ .min_len = sizeof(struct wmi_hw_mode_capabilities) - TLV_HDR_SIZE },
};
#define PRIMAP(_hw_mode_) \
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 3/5] wifi: ath11k: validate DMA ring capability TLVs
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
2026-10-28 5:12 ` [PATCH 1/5] wifi: ath11k: validate DMA buffer release " Jiale Yao
2026-10-28 5:12 ` [PATCH 2/5] wifi: ath11k: validate hardware mode capability TLVs Jiale Yao
@ 2026-10-28 5:12 ` Jiale Yao
2026-10-28 5:12 ` [PATCH 4/5] wifi: ath12k: validate DMA buffer release fixed TLV length Jiale Yao
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jiale Yao @ 2026-10-28 5:12 UTC (permalink / raw)
To: Jeff Johnson, Karthikeyan Periyasamy, Kalle Valo, linux-wireless,
ath11k, linux-kernel
Cc: stable
The service-ready parser counts DMA ring capability TLVs and later
indexes the firmware array using the full structure stride. It does not
validate that each TLV payload covers that structure, so a short element
can cause out-of-bounds reads.
Add a minimum-length policy for DMA ring capability TLVs.
Fixes: bd6478559e27 ("ath11k: Add direct buffer ring support")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/ath/ath11k/wmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 8a73318704f3..c5c667828530 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -167,6 +167,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_dma_buf_release_meta_data) - TLV_HDR_SIZE },
[WMI_TAG_HW_MODE_CAPABILITIES] = {
.min_len = sizeof(struct wmi_hw_mode_capabilities) - TLV_HDR_SIZE },
+ [WMI_TAG_DMA_RING_CAPABILITIES] = {
+ .min_len = sizeof(struct wmi_dma_ring_capabilities) - TLV_HDR_SIZE },
};
#define PRIMAP(_hw_mode_) \
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 4/5] wifi: ath12k: validate DMA buffer release fixed TLV length
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
` (2 preceding siblings ...)
2026-10-28 5:12 ` [PATCH 3/5] wifi: ath11k: validate DMA ring " Jiale Yao
@ 2026-10-28 5:12 ` Jiale Yao
2026-10-28 5:12 ` [PATCH 5/5] wifi: ath12k: validate service-ready capability TLV lengths Jiale Yao
` (2 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Jiale Yao @ 2026-10-28 5:12 UTC (permalink / raw)
To: Jeff Johnson, Karthikeyan Periyasamy, Balamurugan Selvarajan,
Carl Huang, Kalle Valo, Pradeep Kumar Chitrapu, linux-wireless,
ath12k, linux-kernel
Cc: stable
The DMA buffer release parser copies the fixed parameters from a
firmware TLV without checking that its payload contains the complete
structure. A short TLV can therefore make the structure copy read past
the declared payload.
Add a minimum-length policy for the fixed DMA buffer release TLV.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/ath/ath12k/wmi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 75b259990c79..ea7771a2eea9 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -209,6 +209,8 @@ static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
.min_len = sizeof(struct wmi_obss_color_collision_event) },
[WMI_TAG_PDEV_CSA_SWITCH_COUNT_STATUS_EVENT] = {
.min_len = sizeof(struct ath12k_wmi_pdev_csa_event) },
+ [WMI_TAG_DMA_BUF_RELEASE] = {
+ .min_len = sizeof(struct ath12k_wmi_dma_buf_release_fixed_params) },
};
__le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 5/5] wifi: ath12k: validate service-ready capability TLV lengths
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
` (3 preceding siblings ...)
2026-10-28 5:12 ` [PATCH 4/5] wifi: ath12k: validate DMA buffer release fixed TLV length Jiale Yao
@ 2026-10-28 5:12 ` Jiale Yao
2026-10-28 14:55 ` [PATCH 0/5] wifi: ath11k/ath12k: validate " Jeff Johnson
2026-10-29 0:28 ` Jeff Johnson
6 siblings, 0 replies; 9+ messages in thread
From: Jiale Yao @ 2026-10-28 5:12 UTC (permalink / raw)
To: Jeff Johnson, Wen Gong, Pradeep Kumar Chitrapu, Sriram R,
Vasanthakumar Thiagarajan, Kalle Valo, Aloka Dixit,
linux-wireless, ath12k, linux-kernel
Cc: stable
The service-ready parsers consume hardware mode, DMA ring, and extended
MAC/PHY capability TLVs as complete structures without validating their
firmware-declared payload lengths. Short TLVs can therefore cause
out-of-bounds reads while the capability arrays are parsed.
Add minimum-length policies for all three capability TLV types.
Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Fixes: 1476014fadb6 ("wifi: ath12k: WMI support to process EHT capabilities")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/ath/ath12k/wmi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index ea7771a2eea9..730dde686626 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -211,6 +211,12 @@ static const struct ath12k_wmi_tlv_policy ath12k_wmi_tlv_policies[] = {
.min_len = sizeof(struct ath12k_wmi_pdev_csa_event) },
[WMI_TAG_DMA_BUF_RELEASE] = {
.min_len = sizeof(struct ath12k_wmi_dma_buf_release_fixed_params) },
+ [WMI_TAG_HW_MODE_CAPABILITIES] = {
+ .min_len = sizeof(struct ath12k_wmi_hw_mode_cap_params) - TLV_HDR_SIZE },
+ [WMI_TAG_DMA_RING_CAPABILITIES] = {
+ .min_len = sizeof(struct ath12k_wmi_dma_ring_caps_params) - TLV_HDR_SIZE },
+ [WMI_TAG_MAC_PHY_CAPABILITIES_EXT] = {
+ .min_len = sizeof(struct ath12k_wmi_caps_ext_params) },
};
__le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
` (4 preceding siblings ...)
2026-10-28 5:12 ` [PATCH 5/5] wifi: ath12k: validate service-ready capability TLV lengths Jiale Yao
@ 2026-10-28 14:55 ` Jeff Johnson
2026-10-29 0:28 ` Jeff Johnson
6 siblings, 0 replies; 9+ messages in thread
From: Jeff Johnson @ 2026-10-28 14:55 UTC (permalink / raw)
To: Jiale Yao, Jeff Johnson, linux-wireless, ath11k, ath12k
On 10/27/2026 10:12 PM, Jiale Yao wrote:
> Several ath11k and ath12k WMI parsers count firmware TLVs and later
> consume them as arrays of complete capability structures. The generic
> iterator validates that a TLV fits in its enclosing message, but these
> tags have no minimum-length policies, so a short element can still cause
> an out-of-bounds structure read.
>
> Add policies for the DMA buffer release, hardware mode, DMA ring, and
> extended MAC/PHY capability TLVs used by these paths.
>
> Jiale Yao (5):
> wifi: ath11k: validate DMA buffer release TLV lengths
> wifi: ath11k: validate hardware mode capability TLVs
> wifi: ath11k: validate DMA ring capability TLVs
> wifi: ath12k: validate DMA buffer release fixed TLV length
> wifi: ath12k: validate service-ready capability TLV lengths
>
> drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++
> drivers/net/wireless/ath/ath12k/wmi.c | 8 ++++++++
> 2 files changed, 16 insertions(+)
>
-all codeaurora.org and quicinc.com e-mails since they no longer exist
In the future if you fix multiple drivers with one series, please send all
patches to all affected lists. Alternately, split into separate series, one
per driver.
It messes up my processing when a subset is sent to each list.
/jeff
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths
2026-10-28 5:12 [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths Jiale Yao
` (5 preceding siblings ...)
2026-10-28 14:55 ` [PATCH 0/5] wifi: ath11k/ath12k: validate " Jeff Johnson
@ 2026-10-29 0:28 ` Jeff Johnson
2026-10-29 4:20 ` jiale yao
6 siblings, 1 reply; 9+ messages in thread
From: Jeff Johnson @ 2026-10-29 0:28 UTC (permalink / raw)
To: Jiale Yao, Jeff Johnson, linux-wireless, ath11k, ath12k
On 10/27/2026 10:12 PM, Jiale Yao wrote:
> Several ath11k and ath12k WMI parsers count firmware TLVs and later
> consume them as arrays of complete capability structures. The generic
> iterator validates that a TLV fits in its enclosing message, but these
> tags have no minimum-length policies, so a short element can still cause
> an out-of-bounds structure read.
>
> Add policies for the DMA buffer release, hardware mode, DMA ring, and
> extended MAC/PHY capability TLVs used by these paths.
>
> Jiale Yao (5):
> wifi: ath11k: validate DMA buffer release TLV lengths
> wifi: ath11k: validate hardware mode capability TLVs
> wifi: ath11k: validate DMA ring capability TLVs
> wifi: ath12k: validate DMA buffer release fixed TLV length
> wifi: ath12k: validate service-ready capability TLV lengths
>
> drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++
> drivers/net/wireless/ath/ath12k/wmi.c | 8 ++++++++
> 2 files changed, 16 insertions(+)
>
I was surprised by the asymmetry between patch 1 (which just added validation
to the array entry TLVs) and patch 4 (which just added validation to the fixed
params TLV). After a session with an LLM we came to the conclusion that both
are incomplete:
The DMA-buf-release event has two independent OOB sinks in each driver — a
fixed-header copy and a fixed-stride array walk. Both drivers are affected by
both. The series fixes only one sink per driver, and in a complementary
pattern that makes each driver look "done" at a glance but leaves each one
half-covered:
- ath11k: patch 1 guards the array elements (_ENTRY, _META_DATA) ✅ but the
fixed-header memcpy at wmi.c:4669 (16 bytes, unconditional, from firmware
payload) is still unguarded. Needs the [WMI_TAG_DMA_BUF_RELEASE] policy.
- ath12k: patch 4 guards the fixed header ✅ but the array stride reads
ev->buf_entry[i] / ev->meta_data[i] in dbring.c are still unguarded. Needs the
[WMI_TAG_DMA_BUF_RELEASE_ENTRY] and [..._SPECTRAL_META_DATA] policies.
And since you are playing in this area, my LLM thinks that
WMI_TAG_HAL_REG_CAPABILITIES_EXT has this issue in both drivers, and thinks
that WMI_TAG_RSSI_STATS may have this issue. I haven't verified that analysis.
/jeff
^ permalink raw reply [flat|nested] 9+ messages in thread* Re:Re: [PATCH 0/5] wifi: ath11k/ath12k: validate capability TLV lengths
2026-10-29 0:28 ` Jeff Johnson
@ 2026-10-29 4:20 ` jiale yao
0 siblings, 0 replies; 9+ messages in thread
From: jiale yao @ 2026-10-29 4:20 UTC (permalink / raw)
To: Jeff Johnson; +Cc: Jeff Johnson, linux-wireless, ath11k, ath12k
At 2026-10-29 08:28:10, "Jeff Johnson" <jeff.johnson@oss.qualcomm.com> wrote:
>On 10/27/2026 10:12 PM, Jiale Yao wrote:
>> Several ath11k and ath12k WMI parsers count firmware TLVs and later
>> consume them as arrays of complete capability structures. The generic
>> iterator validates that a TLV fits in its enclosing message, but these
>> tags have no minimum-length policies, so a short element can still cause
>> an out-of-bounds structure read.
>>
>> Add policies for the DMA buffer release, hardware mode, DMA ring, and
>> extended MAC/PHY capability TLVs used by these paths.
>>
>> Jiale Yao (5):
>> wifi: ath11k: validate DMA buffer release TLV lengths
>> wifi: ath11k: validate hardware mode capability TLVs
>> wifi: ath11k: validate DMA ring capability TLVs
>> wifi: ath12k: validate DMA buffer release fixed TLV length
>> wifi: ath12k: validate service-ready capability TLV lengths
>>
>> drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++
>> drivers/net/wireless/ath/ath12k/wmi.c | 8 ++++++++
>> 2 files changed, 16 insertions(+)
>>
>
>I was surprised by the asymmetry between patch 1 (which just added validation
>to the array entry TLVs) and patch 4 (which just added validation to the fixed
>params TLV). After a session with an LLM we came to the conclusion that both
>are incomplete:
>
>The DMA-buf-release event has two independent OOB sinks in each driver — a
>fixed-header copy and a fixed-stride array walk. Both drivers are affected by
>both. The series fixes only one sink per driver, and in a complementary
>pattern that makes each driver look "done" at a glance but leaves each one
>half-covered:
>
>- ath11k: patch 1 guards the array elements (_ENTRY, _META_DATA) ✅ but the
>fixed-header memcpy at wmi.c:4669 (16 bytes, unconditional, from firmware
>payload) is still unguarded. Needs the [WMI_TAG_DMA_BUF_RELEASE] policy.
>- ath12k: patch 4 guards the fixed header ✅ but the array stride reads
>ev->buf_entry[i] / ev->meta_data[i] in dbring.c are still unguarded. Needs the
>[WMI_TAG_DMA_BUF_RELEASE_ENTRY] and [..._SPECTRAL_META_DATA] policies.
>
>And since you are playing in this area, my LLM thinks that
>WMI_TAG_HAL_REG_CAPABILITIES_EXT has this issue in both drivers, and thinks
>that WMI_TAG_RSSI_STATS may have this issue. I haven't verified that analysis.
Agree, the updated one is here, https://lore.kernel.org/lkml/20261029041811.2379878-1-yaojiale02@163.com/
>
>/jeff
^ permalink raw reply [flat|nested] 9+ messages in thread