]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 5 Apr 2018 11:17:19 +0000 (14:17 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 25 Apr 2018 08:20:36 +0000 (11:20 +0300)
If "evt_len" is 1 then we try to memcpy() negative 3 bytes and it would
cause memory corruption.

Fixes: d930faee141b ("mwifiex: add support for Marvell pcie8766 chipset")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/pcie.c

index 97a6199692ab5b116dbf1197eb5a8849aa6c904a..7538543d46fa9612c9f43ca3a5052d239cf7bb25 100644 (file)
@@ -1881,7 +1881,8 @@ static int mwifiex_pcie_process_event_ready(struct mwifiex_adapter *adapter)
                mwifiex_dbg(adapter, EVENT,
                            "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 +
                               MWIFIEX_EVENT_HEADER_LEN, evt_len -
                               MWIFIEX_EVENT_HEADER_LEN);