* [PATCH] mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
@ 2018-04-05 11:17 Dan Carpenter
2018-04-25 8:21 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-04-05 11:17 UTC (permalink / raw)
To: Amitkumar Karwar
Cc: Nishant Sarmukadam, Ganapathi Bhat, Xinming Hu, Kalle Valo,
linux-wireless, kernel-janitors
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>
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 97a6199692ab..7538543d46fa 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
2018-04-05 11:17 [PATCH] mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready() Dan Carpenter
@ 2018-04-25 8:21 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2018-04-25 8:21 UTC (permalink / raw)
To: Dan Carpenter
Cc: Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat, Xinming Hu,
linux-wireless, kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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>
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index 97a6199692ab..7538543d46fa 100644
> --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
> @@ -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);
Patch applied to wireless-drivers-next.git, thanks.
01eca2842874 mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
--
https://patchwork.kernel.org/patch/10324435/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-25 8:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 11:17 [PATCH] mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready() Dan Carpenter
2018-04-25 8:21 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).