All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix two possible Buffer overflow in mwifiex
@ 2020-01-02  2:39 m1s5p6688
  2020-01-02  2:39 ` [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() m1s5p6688
  2020-01-02  2:39 ` [PATCH 2/2] mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv() m1s5p6688
  0 siblings, 2 replies; 4+ messages in thread
From: m1s5p6688 @ 2020-01-02  2:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: amitkarwar, nishants, gbhat, huxinming820

From: Qing Xu <m1s5p6688@gmail.com>

Hi,

this is fixes for a few spots that perform memcpy() without checking
the source and the destination size in mwifiex driver, which may lead
to buffer overflows or read over boundary.


Qing Xu

===

Qing Xu (2):
  mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
  mwifiex: Fix possible buffer overflows in
    mwifiex_cmd_append_vsie_tlv()

 drivers/net/wireless/marvell/mwifiex/scan.c | 7 +++++++
 drivers/net/wireless/marvell/mwifiex/wmm.c  | 4 ++++
 2 files changed, 11 insertions(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
  2020-01-02  2:39 [PATCH 0/2] Fix two possible Buffer overflow in mwifiex m1s5p6688
@ 2020-01-02  2:39 ` m1s5p6688
  2020-01-27 14:34   ` Kalle Valo
  2020-01-02  2:39 ` [PATCH 2/2] mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv() m1s5p6688
  1 sibling, 1 reply; 4+ messages in thread
From: m1s5p6688 @ 2020-01-02  2:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: amitkarwar, nishants, gbhat, huxinming820

From: Qing Xu <m1s5p6688@gmail.com>

mwifiex_ret_wmm_get_status() calls memcpy() without checking the 
destination size.Since the source is given from remote AP which 
contains illegal wmm elements , this may trigger a heap buffer 
overflow.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Qing Xu <m1s5p6688@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/wmm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c
index 41f023137..132f9e8ed 100644
--- a/drivers/net/wireless/marvell/mwifiex/wmm.c
+++ b/drivers/net/wireless/marvell/mwifiex/wmm.c
@@ -970,6 +970,10 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
 				    "WMM Parameter Set Count: %d\n",
 				    wmm_param_ie->qos_info_bitmap & mask);
 
+			if (wmm_param_ie->vend_hdr.len + 2 >
+				sizeof(struct ieee_types_wmm_parameter))
+				break;
+
 			memcpy((u8 *) &priv->curr_bss_params.bss_descriptor.
 			       wmm_ie, wmm_param_ie,
 			       wmm_param_ie->vend_hdr.len + 2);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()
  2020-01-02  2:39 [PATCH 0/2] Fix two possible Buffer overflow in mwifiex m1s5p6688
  2020-01-02  2:39 ` [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() m1s5p6688
@ 2020-01-02  2:39 ` m1s5p6688
  1 sibling, 0 replies; 4+ messages in thread
From: m1s5p6688 @ 2020-01-02  2:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: amitkarwar, nishants, gbhat, huxinming820

From: Qing Xu <m1s5p6688@gmail.com>

mwifiex_cmd_append_vsie_tlv() calls memcpy() without checking 
the destination size may trigger a buffer overflower,
which a local user could use to cause denial of service 
or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Qing Xu <m1s5p6688@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/scan.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c
index 98f942b79..a7968a84a 100644
--- a/drivers/net/wireless/marvell/mwifiex/scan.c
+++ b/drivers/net/wireless/marvell/mwifiex/scan.c
@@ -2884,6 +2884,13 @@ mwifiex_cmd_append_vsie_tlv(struct mwifiex_private *priv,
 			vs_param_set->header.len =
 				cpu_to_le16((((u16) priv->vs_ie[id].ie[1])
 				& 0x00FF) + 2);
+			if (le16_to_cpu(vs_param_set->header.len) >
+				MWIFIEX_MAX_VSIE_LEN) {
+				mwifiex_dbg(priv->adapter, ERROR,
+					    "Invalid param length!\n");
+				break;
+			}
+
 			memcpy(vs_param_set->ie, priv->vs_ie[id].ie,
 			       le16_to_cpu(vs_param_set->header.len));
 			*buffer += le16_to_cpu(vs_param_set->header.len) +
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
  2020-01-02  2:39 ` [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() m1s5p6688
@ 2020-01-27 14:34   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-01-27 14:34 UTC (permalink / raw)
  To: m1s5p6688; +Cc: linux-wireless, amitkarwar, nishants, gbhat, huxinming820

m1s5p6688@gmail.com wrote:

> From: Qing Xu <m1s5p6688@gmail.com>
> 
> mwifiex_ret_wmm_get_status() calls memcpy() without checking the 
> destination size.Since the source is given from remote AP which 
> contains illegal wmm elements , this may trigger a heap buffer 
> overflow.
> Fix it by putting the length check before calling memcpy().
> 
> Signed-off-by: Qing Xu <m1s5p6688@gmail.com>

2 patches applied to wireless-drivers.git, thanks.

3a9b153c5591 mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status()
b70261a288ea mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv()

-- 
https://patchwork.kernel.org/patch/11315253/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-27 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-02  2:39 [PATCH 0/2] Fix two possible Buffer overflow in mwifiex m1s5p6688
2020-01-02  2:39 ` [PATCH 1/2] mwifiex: Fix possible buffer overflows in mwifiex_ret_wmm_get_status() m1s5p6688
2020-01-27 14:34   ` Kalle Valo
2020-01-02  2:39 ` [PATCH 2/2] mwifiex: Fix possible buffer overflows in mwifiex_cmd_append_vsie_tlv() m1s5p6688

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.