From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>,
Roee Goldfiner <roee.h.goldfiner@intel.com>,
Gregory Greenman <gregory.greenman@intel.com>,
Sasha Levin <sashal@kernel.org>,
kvalo@kernel.org, miriam.rachel.korenblit@intel.com,
avraham.stern@intel.com, benjamin.berg@intel.com,
jtornosm@redhat.com, linux-wireless@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 08/10] wifi: iwlwifi: mvm: avoid baid size integer overflow
Date: Sun, 9 Jul 2023 11:15:26 -0400 [thread overview]
Message-ID: <20230709151528.513775-8-sashal@kernel.org> (raw)
In-Reply-To: <20230709151528.513775-1-sashal@kernel.org>
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit 1a528ab1da324d078ec60283c34c17848580df24 ]
Roee reported various hard-to-debug crashes with pings in
EHT aggregation scenarios. Enabling KASAN showed that we
access the BAID allocation out of bounds, and looking at
the code a bit shows that since the reorder buffer entry
(struct iwl_mvm_reorder_buf_entry) is 128 bytes if debug
such as lockdep is enabled, then staring from an agg size
512 we overflow the size calculation, and allocate a much
smaller structure than we should, causing slab corruption
once we initialize this.
Fix this by simply using u32 instead of u16.
Reported-by: Roee Goldfiner <roee.h.goldfiner@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.f428c856030d.I2c2bb808e945adb71bc15f5b2bac2d8957ea90eb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 45dfee3ad8c60..2d1755598b475 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2544,7 +2544,7 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
}
if (iwl_mvm_has_new_rx_api(mvm) && start) {
- u16 reorder_buf_size = buf_size * sizeof(baid_data->entries[0]);
+ u32 reorder_buf_size = buf_size * sizeof(baid_data->entries[0]);
/* sparse doesn't like the __align() so don't check */
#ifndef __CHECKER__
--
2.39.2
next prev parent reply other threads:[~2023-07-09 15:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-09 15:15 [PATCH AUTOSEL 5.15 01/10] wifi: ath11k: fix registration of 6Ghz-only phy without the full channel range Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 02/10] wifi: rtw89: 8851be: add 8851BE PCI entry and fill PCI capabilities Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 03/10] bpf: Address KCSAN report on bpf_lru_list Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 04/10] bpf: tcp: Avoid taking fast sock lock in iterator Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 05/10] net: ethernet: litex: add support for 64 bit stats Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 06/10] devlink: report devlink_port_type_warn source device Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 07/10] wifi: wext-core: Fix -Wstringop-overflow warning in ioctl_standard_iw_point() Sasha Levin
2023-07-09 15:15 ` Sasha Levin [this message]
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 09/10] igb: Fix igb_down hung on surprise removal Sasha Levin
2023-07-09 15:15 ` [PATCH AUTOSEL 5.15 10/10] net: hns3: fix strncpy() not using dest-buf length as length issue Sasha Levin
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=20230709151528.513775-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=avraham.stern@intel.com \
--cc=benjamin.berg@intel.com \
--cc=gregory.greenman@intel.com \
--cc=johannes.berg@intel.com \
--cc=jtornosm@redhat.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
--cc=roee.h.goldfiner@intel.com \
--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