mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
wifi: iwlwifi: fix 22000 series SMEM parsing
If the firmware were to report three LMACs (which doesn't exist in hardware) then using "fwrt->smem_cfg.lmac[2]" is an overrun of the array. Reject such and use IWL_FW_CHECK instead of WARN_ON in this function. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20251110150012.16e8c2d70c26.Iadfcc1aedf43c5175b3f0757bea5aa232454f1ac@changeid
This commit is contained in:
parent
5f05d20180
commit
58192b9ce0
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
#include "iwl-drv.h"
|
||||
#include "runtime.h"
|
||||
#include "dbg.h"
|
||||
#include "fw/api/commands.h"
|
||||
|
||||
static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt,
|
||||
|
|
@ -17,7 +18,9 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt,
|
|||
u8 api_ver = iwl_fw_lookup_notif_ver(fwrt->fw, SYSTEM_GROUP,
|
||||
SHARED_MEM_CFG_CMD, 0);
|
||||
|
||||
if (WARN_ON(lmac_num > ARRAY_SIZE(mem_cfg->lmac_smem)))
|
||||
/* Note: notification has 3 entries, but we only expect 2 */
|
||||
if (IWL_FW_CHECK(fwrt, lmac_num > ARRAY_SIZE(fwrt->smem_cfg.lmac),
|
||||
"FW advertises %d LMACs\n", lmac_num))
|
||||
return;
|
||||
|
||||
fwrt->smem_cfg.num_lmacs = lmac_num;
|
||||
|
|
@ -26,7 +29,8 @@ static void iwl_parse_shared_mem_22000(struct iwl_fw_runtime *fwrt,
|
|||
fwrt->smem_cfg.rxfifo2_size = le32_to_cpu(mem_cfg->rxfifo2_size);
|
||||
|
||||
if (api_ver >= 4 &&
|
||||
!WARN_ON_ONCE(iwl_rx_packet_payload_len(pkt) < sizeof(*mem_cfg))) {
|
||||
!IWL_FW_CHECK(fwrt, iwl_rx_packet_payload_len(pkt) < sizeof(*mem_cfg),
|
||||
"bad shared mem notification size\n")) {
|
||||
fwrt->smem_cfg.rxfifo2_control_size =
|
||||
le32_to_cpu(mem_cfg->rxfifo2_control_size);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user