summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorTianchu Chen <flynnnchen@tencent.com>2026-09-23 14:43:51 +0000
committerJohannes Berg <johannes.berg@intel.com>2026-09-28 11:19:47 +0200
commitdbca9dfd3bfc6fd3592a0fee997bf418f805c321 (patch)
tree95fe23eb8bb294f72aa9ac719a55b6f407cae9e7 /drivers/net
parent1359b631c7c8455de947b2cc44b335b0ebc84d9e (diff)
downloadlinux-next-dbca9dfd3bfc6fd3592a0fee997bf418f805c321.tar.gz
linux-next-dbca9dfd3bfc6fd3592a0fee997bf418f805c321.zip
wifi: mwifiex: bound SDIO fw dump count by memory table size
mwifiex_sdio_fw_dump() reads the number of memory regions (dump_num) from a device register and uses it to index the static 15-entry mem_type_mapping_tbl[] without any bounds check. A bogus device can report a dump_num larger than the table; each out-of-table loop iteration then reads entry->mem_name and entry->done_flag and stores a vmalloc pointer and a device-controlled size past the end of the table, into adjacent .data (up to ~5.6KiB when dump_num is 255). The dump path runs after command timeouts or firmware crashes, so a bogus device can first force an error to trigger the dump and then report a bogus dump_num. Limit dump_num to the table size instead of aborting the dump. This is not expected to change the behavior on normal devices. Discovered by Atuin - Automated Vulnerability Discovery Engine. Assisted-by: LLM Signed-off-by: Tianchu Chen <flynnnchen@tencent.com> Acked-by: Brian Norris <briannorris@chromium.org> Link: https://patch.msgid.link/33a45fd59b5569cbce79142d2e012e191989ec26@linux.dev Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/marvell/mwifiex/sdio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index f039d6f19183..c15d6e1dd8f6 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2795,6 +2795,9 @@ static void mwifiex_sdio_fw_dump(struct mwifiex_adapter *adapter)
mwifiex_dbg(adapter, ERROR, "SDIO read memory length err\n");
goto done;
}
+ /* Limit the dump count to the memory table size */
+ if (dump_num > ARRAY_SIZE(mem_type_mapping_tbl))
+ dump_num = ARRAY_SIZE(mem_type_mapping_tbl);
/* Read the length of every memory which will dump */
for (idx = 0; idx < dump_num; idx++) {