From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>,
syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com,
Jeff Johnson <quic_jjohnson@quicinc.com>,
Sasha Levin <sashal@kernel.org>,
kvalo@kernel.org, linux-wireless@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 24/26] wifi: mac80211_hwsim: drop short frames
Date: Fri, 8 Sep 2023 14:18:02 -0400 [thread overview]
Message-ID: <20230908181806.3460164-24-sashal@kernel.org> (raw)
In-Reply-To: <20230908181806.3460164-1-sashal@kernel.org>
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit fba360a047d5eeeb9d4b7c3a9b1c8308980ce9a6 ]
While technically some control frames like ACK are shorter and
end after Address 1, such frames shouldn't be forwarded through
wmediumd or similar userspace, so require the full 3-address
header to avoid accessing invalid memory if shorter frames are
passed in.
Reported-by: syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.com
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mac80211_hwsim.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index da5c355405f68..db70cef854bc4 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -4906,14 +4906,15 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
frame_data_len = nla_len(info->attrs[HWSIM_ATTR_FRAME]);
frame_data = (void *)nla_data(info->attrs[HWSIM_ATTR_FRAME]);
+ if (frame_data_len < sizeof(struct ieee80211_hdr_3addr) ||
+ frame_data_len > IEEE80211_MAX_DATA_LEN)
+ goto err;
+
/* Allocate new skb here */
skb = alloc_skb(frame_data_len, GFP_KERNEL);
if (skb == NULL)
goto err;
- if (frame_data_len > IEEE80211_MAX_DATA_LEN)
- goto err;
-
/* Copy the data */
skb_put_data(skb, frame_data, frame_data_len);
--
2.40.1
prev parent reply other threads:[~2023-09-08 18:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230908181806.3460164-1-sashal@kernel.org>
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 04/26] wifi: ath9k: fix fortify warnings Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 05/26] wifi: ath9k: fix printk specifier Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 06/26] wifi: mwifiex: fix fortify warning Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 07/26] mt76: mt7921: don't assume adequate headroom for SDIO headers Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 08/26] wifi: wil6210: fix fortify warnings Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 19/26] wifi: mac80211: check S1G action frame size Sasha Levin
2023-09-08 18:17 ` [PATCH AUTOSEL 6.1 21/26] wifi: cfg80211: reject auth/assoc to AP with our address Sasha Levin
2023-09-08 18:18 ` [PATCH AUTOSEL 6.1 22/26] wifi: cfg80211: ocb: don't leave if not joined Sasha Levin
2023-09-08 18:18 ` [PATCH AUTOSEL 6.1 23/26] wifi: mac80211: check for station first in client probe Sasha Levin
2023-09-08 18:18 ` Sasha Levin [this message]
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=20230908181806.3460164-24-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=johannes.berg@intel.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_jjohnson@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+b2645b5bf1512b81fa22@syzkaller.appspotmail.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).