Commit 01eca284 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kalle Valo

mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()

If "evt_len" is 1 then we try to memcpy() negative 3 bytes and it would
cause memory corruption.

Fixes: d930faee ("mwifiex: add support for Marvell pcie8766 chipset")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c1003538
...@@ -1881,7 +1881,8 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter) ...@@ -1881,7 +1881,8 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter)
mwifiex_dbg(adapter, EVENT, mwifiex_dbg(adapter, EVENT,
"info: Event length: %d\n", evt_len); "info: Event length: %d\n", evt_len);
if ((evt_len > 0) && (evt_len < MAX_EVENT_SIZE)) if (evt_len > MWIFIEX_EVENT_HEADER_LEN &&
evt_len < MAX_EVENT_SIZE)
memcpy(adapter->event_body, skb_cmd->data + memcpy(adapter->event_body, skb_cmd->data +
MWIFIEX_EVENT_HEADER_LEN, evt_len - MWIFIEX_EVENT_HEADER_LEN, evt_len -
MWIFIEX_EVENT_HEADER_LEN); MWIFIEX_EVENT_HEADER_LEN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment