]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: make sure cur_fw_img is valid before accessing img
authorLuca Coelho <luciano.coelho@intel.com>
Tue, 6 Nov 2018 06:24:12 +0000 (08:24 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 29 Jan 2019 14:10:30 +0000 (16:10 +0200)
Harden the fwrt->fw->img array access by making sure the cur_fw_img
value doesn't go out of bounds.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/dbg.h

index d8090d4b5c435acd88a9e243100485a66d7ac2b0..330229d2a61d35dd2bd3caeb5a584a3e2c71e774 100644 (file)
@@ -381,6 +381,7 @@ static inline bool iwl_fw_dbg_is_paging_enabled(struct iwl_fw_runtime *fwrt)
 {
        return iwl_fw_dbg_type_on(fwrt, IWL_FW_ERROR_DUMP_PAGING) &&
                !fwrt->trans->cfg->gen2 &&
+               fwrt->cur_fw_img < IWL_UCODE_TYPE_MAX &&
                fwrt->fw->img[fwrt->cur_fw_img].paging_mem_size &&
                fwrt->fw_paging_db[0].fw_paging_block;
 }