linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: mwifiex: Fix integer underflow in mwifiex_process_mgmt_packet
@ 2023-07-05  4:43 pinkperfect
  2023-07-13  0:51 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: pinkperfect @ 2023-07-05  4:43 UTC (permalink / raw)
  To: amitkarwar, kvalo; +Cc: linux-wireless, linux-kernel, pinkperfect

In outside functions have checked upper limit of rx_pkt_length,
in mwifiex_process_mgmt_packet should make sure rx_pkt_length not underflow
to avoid OOB access.

Signed-off-by: pinkperfect <pinkperfect2021@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/util.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
index 94c2d219835d..4291252e06ea 100644
--- a/drivers/net/wireless/marvell/mwifiex/util.c
+++ b/drivers/net/wireless/marvell/mwifiex/util.c
@@ -399,6 +399,11 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 
 	pkt_len = le16_to_cpu(rx_pd->rx_pkt_length);
 
+	if (pkt_len < sizeof(struct ieee80211_hdr)) {
+		mwifiex_dbg(priv->adapter, ERROR, "invalid rx_pkt_length");
+		return -1;
+	}
+
 	ieee_hdr = (void *)skb->data;
 	if (ieee80211_is_mgmt(ieee_hdr->frame_control)) {
 		if (mwifiex_parse_mgmt_packet(priv, (u8 *)ieee_hdr,
-- 
2.25.1


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

* Re: [PATCH] wifi: mwifiex: Fix integer underflow in mwifiex_process_mgmt_packet
  2023-07-05  4:43 [PATCH] wifi: mwifiex: Fix integer underflow in mwifiex_process_mgmt_packet pinkperfect
@ 2023-07-13  0:51 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2023-07-13  0:51 UTC (permalink / raw)
  To: pinkperfect; +Cc: amitkarwar, kvalo, linux-wireless, linux-kernel

On Wed,  5 Jul 2023 04:43:50 +0000 pinkperfect wrote:
> In outside functions have checked upper limit of rx_pkt_length,
> in mwifiex_process_mgmt_packet should make sure rx_pkt_length not underflow
> to avoid OOB access.

Please add a Fixes tag.

> Signed-off-by: pinkperfect <pinkperfect2021@gmail.com>

We need something close to your legal name, or basically know who you
are. Because of developer certificate of origin. We're working on real
code under real copyright law..

> diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
> index 94c2d219835d..4291252e06ea 100644
> --- a/drivers/net/wireless/marvell/mwifiex/util.c
> +++ b/drivers/net/wireless/marvell/mwifiex/util.c
> @@ -399,6 +399,11 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
>  
>  	pkt_len = le16_to_cpu(rx_pd->rx_pkt_length);
>  
> +	if (pkt_len < sizeof(struct ieee80211_hdr)) {

The callers also look at the header and the MAC addresses in it.
I think we need to pull this check earlier.

> +		mwifiex_dbg(priv->adapter, ERROR, "invalid rx_pkt_length");
> +		return -1;

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

end of thread, other threads:[~2023-07-13  0:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-05  4:43 [PATCH] wifi: mwifiex: Fix integer underflow in mwifiex_process_mgmt_packet pinkperfect
2023-07-13  0:51 ` Jakub Kicinski

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).