* [PATCH v2 wireless 1/3] wifi: mwifiex: validate TID in ADDBA response handler
2026-11-24 17:46 [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Tristan Madani
@ 2026-11-24 17:46 ` Tristan Madani
2026-11-24 17:46 ` [PATCH v2 wireless 2/3] wifi: mwifiex: validate intf_num in multichannel event handler Tristan Madani
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Tristan Madani @ 2026-11-24 17:46 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini
Cc: Jeff Chen, linux-wireless, stable, Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
The TID value extracted from the Block Ack parameter set is a 4-bit
field (0-15), but aggr_prio_tbl[] has only MAX_NUM_TID (8) entries.
A value >= 8 causes an out-of-bounds array access.
Add a bounds check after extracting the TID.
Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Cc: stable@vger.kernel.org
Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com>
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/marvell/mwifiex/11n.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c
index cef8a55427dd0..7d249508e1a38 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n.c
@@ -154,6 +154,12 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
tid = (block_ack_param_set & IEEE80211_ADDBA_PARAM_TID_MASK)
>> BLOCKACKPARAM_TID_POS;
+ if (tid >= MAX_NUM_TID) {
+ mwifiex_dbg(priv->adapter, ERROR,
+ "ADDBA RSP: invalid tid %d\n", tid);
+ return -EINVAL;
+ }
+
tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
ra_list = mwifiex_wmm_get_ralist_node(priv, tid_down, add_ba_rsp->
peer_mac_addr);
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v2 wireless 2/3] wifi: mwifiex: validate intf_num in multichannel event handler
2026-11-24 17:46 [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Tristan Madani
2026-11-24 17:46 ` [PATCH v2 wireless 1/3] wifi: mwifiex: validate TID in ADDBA response handler Tristan Madani
@ 2026-11-24 17:46 ` Tristan Madani
2026-11-24 17:46 ` [PATCH v2 wireless 3/3] wifi: mwifiex: cap TLV length in IBSS connected " Tristan Madani
2026-11-24 18:00 ` [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Brian Norris
3 siblings, 0 replies; 5+ messages in thread
From: Tristan Madani @ 2026-11-24 17:46 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini
Cc: Jeff Chen, linux-wireless, stable, Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
The intf_num field from the multichannel group info TLV indexes the
flexible array bss_type_numlist[] without checking whether it fits
the TLV data. An intf_num larger than the available data causes reads
past the TLV boundary.
Add a check that intf_num does not exceed the number of entries that
fit in the TLV data.
Fixes: 8d6b538a5eac ("mwifiex: handle multichannel event")
Cc: stable@vger.kernel.org
Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com>
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c
index fecd88967ceb8..1f746e8f6b3e1 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
@@ -450,6 +450,10 @@ void mwifiex_process_multi_chan_event(struct mwifiex_private *priv,
grp_info = (struct mwifiex_ie_types_mc_group_info *)tlv;
intf_num = grp_info->intf_num;
+ if (tlv_len < sizeof(*grp_info) - sizeof(grp_info->header) ||
+ intf_num > tlv_len - (sizeof(*grp_info) - sizeof(grp_info->header)))
+ break;
+
for (i = 0; i < intf_num; i++) {
bss_type = grp_info->bss_type_numlist[i] >> 4;
bss_num = grp_info->bss_type_numlist[i] & BSS_NUM_MASK;
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v2 wireless 3/3] wifi: mwifiex: cap TLV length in IBSS connected event handler
2026-11-24 17:46 [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Tristan Madani
2026-11-24 17:46 ` [PATCH v2 wireless 1/3] wifi: mwifiex: validate TID in ADDBA response handler Tristan Madani
2026-11-24 17:46 ` [PATCH v2 wireless 2/3] wifi: mwifiex: validate intf_num in multichannel event handler Tristan Madani
@ 2026-11-24 17:46 ` Tristan Madani
2026-11-24 18:00 ` [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Brian Norris
3 siblings, 0 replies; 5+ messages in thread
From: Tristan Madani @ 2026-11-24 17:46 UTC (permalink / raw)
To: Brian Norris, Francesco Dolcini
Cc: Jeff Chen, linux-wireless, stable, Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
In the IBSS connected event handler, the buffer-bounded evt_len is
replaced with the TLV header length from the firmware. An inflated
value drives the IE parsing loop past the event buffer.
After the fixed-size header advance, check that curr has not overshot
the event data before computing the remaining length -- the
subtraction wraps when curr is past the end because event->len is
unsigned. Then cap the TLV-derived length at the remaining data size.
Fixes: 432da7d243da ("mwifiex: add HT aggregation support for adhoc mode")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c
index 1f746e8f6b3e1..98f33ec186e63 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
@@ -45,6 +45,10 @@ static int mwifiex_check_ibss_peer_capabilities(struct mwifiex_private *priv,
*/
evt_len = le16_to_cpu(tlv_mgmt_frame->header.len);
curr += (sizeof(*tlv_mgmt_frame) + 12);
+ if (curr > event->data + event->len)
+ return 0;
+ if (evt_len > event->len - (curr - event->data))
+ evt_len = event->len - (curr - event->data);
} else {
mwifiex_dbg(priv->adapter, MSG,
"management frame tlv not found!\n");
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues
2026-11-24 17:46 [PATCH v2 wireless 0/3] wifi: mwifiex: fix three firmware-triggered validation issues Tristan Madani
` (2 preceding siblings ...)
2026-11-24 17:46 ` [PATCH v2 wireless 3/3] wifi: mwifiex: cap TLV length in IBSS connected " Tristan Madani
@ 2026-11-24 18:00 ` Brian Norris
3 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2026-11-24 18:00 UTC (permalink / raw)
To: Tristan Madani
Cc: Francesco Dolcini, Jeff Chen, linux-wireless, stable,
Tristan Madani
On Tue, Nov 24, 2026 at 05:46:17PM +0000, Tristan Madani wrote:
> From: Tristan Madani <tristan@talencesecurity.com>
>
> Three validation fixes for firmware-provided data in mwifiex:
>
> Patch 1 bounds-checks the TID extracted from ADDBA responses before
> indexing aggr_prio_tbl[].
>
> Patch 2 validates intf_num in multichannel group info TLVs against
> the available TLV data length.
>
> Patch 3 caps the TLV-derived length in IBSS connected events at the
> remaining event buffer size, with an additional guard against
> unsigned underflow when the fixed-size header advance overshoots
> the buffer.
>
> v2:
> - Patch 3: add underflow guard before computing remaining length,
> as pointed out by Jeff Chen: when the header advance overshoots
> the buffer, the unsigned subtraction wraps (Jeff Chen)
Please include information about how you're testing these. (You're
testing this, right?)
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread