public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Zhang Xiaohui <ruc_zhangxiaohui@163.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 20/20] mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start
Date: Thu,  7 Jan 2021 15:34:15 +0100	[thread overview]
Message-ID: <20210107143055.225834422@linuxfoundation.org> (raw)
In-Reply-To: <20210107143052.392839477@linuxfoundation.org>

From: Zhang Xiaohui <ruc_zhangxiaohui@163.com>

[ Upstream commit 5c455c5ab332773464d02ba17015acdca198f03d ]

mwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking
the destination size may trigger a buffer overflower,
which a local user could use to cause denial of service
or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().

Signed-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201206084801.26479-1-ruc_zhangxiaohui@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/marvell/mwifiex/join.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/join.c b/drivers/net/wireless/marvell/mwifiex/join.c
index 5934f71475477..173ccf79cbfcc 100644
--- a/drivers/net/wireless/marvell/mwifiex/join.c
+++ b/drivers/net/wireless/marvell/mwifiex/join.c
@@ -877,6 +877,8 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
 
 	memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN);
 
+	if (req_ssid->ssid_len > IEEE80211_MAX_SSID_LEN)
+		req_ssid->ssid_len = IEEE80211_MAX_SSID_LEN;
 	memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len);
 
 	mwifiex_dbg(adapter, INFO, "info: ADHOC_S_CMD: SSID = %s\n",
-- 
2.27.0




  parent reply	other threads:[~2021-01-07 14:34 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 14:33 [PATCH 5.10 00/20] 5.10.6-rc1 review Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 01/20] Revert "drm/amd/display: Fix memory leaks in S3 resume" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 02/20] Revert "mtd: spinand: Fix OOB read" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 03/20] rtc: pcf2127: move watchdog initialisation to a separate function Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.10 04/20] rtc: pcf2127: only use watchdog when explicitly available Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 05/20] dt-bindings: rtc: add reset-source property Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 06/20] kdev_t: always inline major/minor helper functions Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 07/20] Bluetooth: Fix attempting to set RPA timeout when unsupported Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 08/20] ALSA: hda/realtek - Modify Dell platform name Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 09/20] ALSA: hda/hdmi: Fix incorrect mutex unlock in silent_stream_disable() Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 10/20] drm/i915/tgl: Fix Combo PHY DPLL fractional divider for 38.4MHz ref clock Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 11/20] scsi: ufs: Allow an error return value from ->device_reset() Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 12/20] scsi: ufs: Re-enable WriteBooster after device reset Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 13/20] RDMA/core: remove use of dma_virt_ops Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 14/20] RDMA/siw,rxe: Make emulated devices virtual in the device tree Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 15/20] fuse: fix bad inode Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 16/20] perf: Break deadlock involving exec_update_mutex Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 17/20] rwsem: Implement down_read_killable_nested Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 18/20] rwsem: Implement down_read_interruptible Greg Kroah-Hartman
2021-01-07 14:34 ` [PATCH 5.10 19/20] exec: Transform exec_update_mutex into a rw_semaphore Greg Kroah-Hartman
2021-01-07 14:34 ` Greg Kroah-Hartman [this message]
2021-01-08  1:10 ` [PATCH 5.10 00/20] 5.10.6-rc1 review Shuah Khan
2021-01-10 11:30   ` Greg Kroah-Hartman
2021-01-08  2:02 ` Naresh Kamboju
2021-01-10 11:30   ` Greg Kroah-Hartman
2021-01-08 17:41 ` Guenter Roeck
2021-01-10 11:31   ` Greg Kroah-Hartman

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=20210107143055.225834422@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruc_zhangxiaohui@163.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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