From: pinkperfect <pinkperfect2021@gmail.com>
To: amitkarwar@gmail.com, kvalo@kernel.org, ganapathi017@gmail.com,
sharvari.harisangam@nxp.com, huxinming820@gmail.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
pinkperfect <pinkperfect2021@gmail.com>
Subject: [PATCH] wifi: mwifiex: Security: Fix memcpy oobs in mwifiex_set_encode
Date: Thu, 6 Jul 2023 02:07:51 +0000 [thread overview]
Message-ID: <20230706020751.859773-1-pinkperfect2021@gmail.com> (raw)
In cfg80211 flow, when handling userspace netlink messages
if input cipher mode is WLAN_CIPHER_SUITE_SMS4
will make cfg80211_validate_key_settings not check key_len and seq_len
which will cause controllable memcpy overwrite
So needs to check them in mwifiex_set_encode.
Signed-off-by: pinkperfect <pinkperfect2021@gmail.com>
---
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index a2ad2b53f016..bddc11eac8a9 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -1099,6 +1099,11 @@ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
{
struct mwifiex_ds_encrypt_key encrypt_key;
+ if (key_len > WLAN_MAX_KEY_LEN || (kp && kp->seq_len > PN_LEN)) {
+ mwifiex_dbg(priv->adapter, ERROR, "invalid parameters");
+ return -1;
+ }
+
memset(&encrypt_key, 0, sizeof(encrypt_key));
encrypt_key.key_len = key_len;
encrypt_key.key_index = key_index;
--
2.25.1
next reply other threads:[~2023-07-06 2:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 2:07 pinkperfect [this message]
2023-07-08 6:48 ` [PATCH] wifi: mwifiex: " pinkperfect
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=20230706020751.859773-1-pinkperfect2021@gmail.com \
--to=pinkperfect2021@gmail.com \
--cc=amitkarwar@gmail.com \
--cc=ganapathi017@gmail.com \
--cc=huxinming820@gmail.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sharvari.harisangam@nxp.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
all inboxes | Powered by JetHome®