From: Tristan Madani 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 Signed-off-by: Tristan Madani --- 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 From: Tristan Madani 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 Signed-off-by: Tristan Madani --- 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 From: Tristan Madani 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 --- 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