All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bing Zhao <bzhao@marvell.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] mwifiex: potential integer underflow in mwifiex_ret_wmm_get_status()
Date: Wed, 25 Sep 2013 08:57:30 +0000	[thread overview]
Message-ID: <20130925085729.GC6661@elgon.mountain> (raw)

If "resp_len" gets set to negative then it counts as a high positive
value.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I spotted this reviewing the int => bool changes, but I don't have the
hardware and can't test it.

diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 2e8f9cd..3c6ee3a 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -772,6 +772,8 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
 			break;
 		}
 
+		if (resp_len < tlv_len + sizeof(tlv_hdr->header))
+			break;
 		curr += (tlv_len + sizeof(tlv_hdr->header));
 		resp_len -= (tlv_len + sizeof(tlv_hdr->header));
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Bing Zhao <bzhao@marvell.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] mwifiex: potential integer underflow in mwifiex_ret_wmm_get_status()
Date: Wed, 25 Sep 2013 11:57:30 +0300	[thread overview]
Message-ID: <20130925085729.GC6661@elgon.mountain> (raw)

If "resp_len" gets set to negative then it counts as a high positive
value.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I spotted this reviewing the int => bool changes, but I don't have the
hardware and can't test it.

diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 2e8f9cd..3c6ee3a 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -772,6 +772,8 @@ int mwifiex_ret_wmm_get_status(struct mwifiex_private *priv,
 			break;
 		}
 
+		if (resp_len < tlv_len + sizeof(tlv_hdr->header))
+			break;
 		curr += (tlv_len + sizeof(tlv_hdr->header));
 		resp_len -= (tlv_len + sizeof(tlv_hdr->header));
 	}

             reply	other threads:[~2013-09-25  8:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25  8:57 Dan Carpenter [this message]
2013-09-25  8:57 ` [patch] mwifiex: potential integer underflow in mwifiex_ret_wmm_get_status() Dan Carpenter
2013-09-25 16:25 ` Bing Zhao
2013-09-25 16:25   ` Bing Zhao
2013-09-25 18:23   ` Dan Carpenter
2013-09-25 18:23     ` Dan Carpenter
2013-09-25 23:10     ` Bing Zhao
2013-09-25 23:10       ` Bing Zhao
2013-09-26 20:57       ` Bing Zhao
2013-09-26 20:57         ` Bing Zhao
2013-09-26 21:07         ` Dan Carpenter
2013-09-26 21:07           ` Dan Carpenter
2013-09-26 21:57           ` Bing Zhao
2013-09-26 21:57             ` Bing Zhao
2013-10-10 17:26             ` John W. Linville
2013-10-10 17:26               ` John W. Linville
2013-10-10 18:02               ` Bing Zhao
2013-10-10 18:02                 ` Bing Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130925085729.GC6661@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=bzhao@marvell.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.