Linux wireless drivers development
 help / color / mirror / Atom feed
From: Maya Erez <qca_merez@qca.qualcomm.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Lior David <qca_liord@qca.qualcomm.com>,
	linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com,
	Maya Erez <qca_merez@qca.qualcomm.com>
Subject: [PATCH 07/12] wil6210: missing length check in wmi_set_ie
Date: Wed, 25 Oct 2017 16:14:02 +0300	[thread overview]
Message-ID: <1508937247-11890-8-git-send-email-qca_merez@qca.qualcomm.com> (raw)
In-Reply-To: <1508937247-11890-1-git-send-email-qca_merez@qca.qualcomm.com>

From: Lior David <qca_liord@qca.qualcomm.com>

Add a length check in wmi_set_ie to detect unsigned integer
overflow.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
---
 drivers/net/wireless/ath/wil6210/wmi.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
index 16aa624..dd25f63 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -1616,8 +1616,14 @@ int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
 	};
 	int rc;
 	u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
-	struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
+	struct wmi_set_appie_cmd *cmd;
 
+	if (len < ie_len) {
+		rc = -EINVAL;
+		goto out;
+	}
+
+	cmd = kzalloc(len, GFP_KERNEL);
 	if (!cmd) {
 		rc = -ENOMEM;
 		goto out;
-- 
1.9.1

  parent reply	other threads:[~2017-10-25 13:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 13:13 [PATCH 00/12] wil6210 patches Maya Erez
2017-10-25 13:13 ` [PATCH 01/12] wil6210: run-time PM when interface down Maya Erez
2017-10-27 13:33   ` [01/12] " Kalle Valo
2017-10-29 19:58     ` Maya Haim
2017-10-25 13:13 ` [PATCH 02/12] wil6210: print human readable names of WMI commands and events Maya Erez
2017-10-25 13:13 ` [PATCH 03/12] wil6210: refresh FW capabilities during interface up Maya Erez
2017-10-28 15:01   ` Kalle Valo
2017-10-28 15:25     ` Lior David
2017-10-30  6:54       ` Kalle Valo
2017-10-25 13:13 ` [PATCH 04/12] wil6210: abort properly in cfg suspend Maya Erez
2017-10-25 13:14 ` [PATCH 05/12] wil6210: fix length check in __wmi_send Maya Erez
2017-10-25 13:14 ` [PATCH 06/12] wil6210: add block size checks during FW load Maya Erez
2017-10-25 13:14 ` Maya Erez [this message]
2017-10-25 13:14 ` [PATCH 08/12] wil6210: missing length check in wil_cfg80211_mgmt_tx Maya Erez
2017-10-25 13:14 ` [PATCH 09/12] wil6210: get suspend reject reason and resume triggers from FW Maya Erez
2017-10-25 13:14 ` [PATCH 10/12] wil6210: fix PCIe bus mastering in case of interface down Maya Erez
2017-10-25 13:14 ` [PATCH 11/12] wil6210: remove suspend time statistics Maya Erez
2017-10-25 13:14 ` [PATCH 12/12] wil6210: update statistics for suspend Maya Erez
2017-10-28 15:18   ` Kalle Valo

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=1508937247-11890-8-git-send-email-qca_merez@qca.qualcomm.com \
    --to=qca_merez@qca.qualcomm.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=qca_liord@qca.qualcomm.com \
    --cc=wil6210@qca.qualcomm.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