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