linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avinash Patil <patila@marvell.com>
To: <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>, <akarwar@marvell.com>,
	<cluo@marvell.com>, <yangyang@marvell.com>,
	Xinming Hu <huxm@marvell.com>, Avinash Patil <patila@marvell.com>
Subject: [PATCH 2/4] mwifiex: do not send key material cmd when delete wep key
Date: Wed, 17 Dec 2014 17:20:41 +0530	[thread overview]
Message-ID: <1418817043-22511-2-git-send-email-patila@marvell.com> (raw)
In-Reply-To: <1418817043-22511-1-git-send-email-patila@marvell.com>

From: Xinming Hu <huxm@marvell.com>

This patch fixes memory corruption reported by community developer.

"Memory corruption occurs in mwifiex_ret_802_11_key_material_v1()
when a short command response is received without a key length
causing non initialised memory to be interpreted as the key
length resulting in a memcpy() overwriting the part of the
driver's private data structure beyond the key area."

For v1 key material API firmwares, there is no need to send
command to delete WEP key. WEP encryption/decryption is controlled
by mac_control command.

This patch avoids sending key material command in del_key case.

Reported-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 1626868..fb9c5fc 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -902,9 +902,12 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
 	if (wep_key->key_length) {
 		void *enc_key;
 
-		if (encrypt_key->key_disable)
+		if (encrypt_key->key_disable) {
 			memset(&priv->wep_key[index], 0,
 			       sizeof(struct mwifiex_wep_key));
+			if (wep_key->key_length)
+				goto done;
+			}
 
 		if (adapter->key_api_major_ver == KEY_API_VER_MAJOR_V2)
 			enc_key = encrypt_key;
@@ -918,6 +921,7 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
 			return ret;
 	}
 
+done:
 	if (priv->sec_info.wep_enabled)
 		priv->curr_pkt_filter |= HostCmd_ACT_MAC_WEP_ENABLE;
 	else
-- 
1.8.1.4


       reply	other threads:[~2014-12-17  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1418817043-22511-1-git-send-email-patila@marvell.com>
2014-12-17 11:50 ` Avinash Patil [this message]
2014-12-17 11:50 ` [PATCH 3/4] mwifiex: make tx packet 64 byte DMA aligned Avinash Patil
2014-12-17 11:50 ` [PATCH 4/4] mwifiex: get supported BA stream info from FW Avinash Patil
2014-12-17 11:54 [PATCH 1/4] mwifiex: enable -D__CHECK_ENDIAN__ for sparse by default Avinash Patil
2014-12-17 11:54 ` [PATCH 2/4] mwifiex: do not send key material cmd when delete wep key Avinash Patil
2014-12-17 13:56 [PATCH 1/4] mwifiex: enable -D__CHECK_ENDIAN__ for sparse by default Avinash Patil
2014-12-17 13:56 ` [PATCH 2/4] mwifiex: do not send key material cmd when delete wep key Avinash Patil

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=1418817043-22511-2-git-send-email-patila@marvell.com \
    --to=patila@marvell.com \
    --cc=akarwar@marvell.com \
    --cc=cluo@marvell.com \
    --cc=huxm@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=yangyang@marvell.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 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).