]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iwlwifi: pcie: warn if paging is already initialized during init
authorJohannes Berg <johannes.berg@intel.com>
Wed, 31 May 2017 11:19:10 +0000 (13:19 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 29 Jun 2017 10:26:26 +0000 (13:26 +0300)
This appears to happen in some cases, like when iwlmvm is unloaded and
loaded again without also unloading iwlwifi. Warn in this case and free
the paging data to be able to continue without causing corruption and
kernel crashes due to it (otherwise, paging data is overwritten, but
dram->paging_cnt gets to be twice as big as it should be, and then an
eventual free will crash.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c

index 00d1a5f048b354b0f1f97c0a773d5a1aea0dd9ec..eddaca76d51490b102d5c527c886b02e967066de 100644 (file)
@@ -137,6 +137,11 @@ static int iwl_pcie_ctxt_info_init_fw_sec(struct iwl_trans *trans,
        struct iwl_context_info_dram *ctxt_dram = &ctxt_info->dram;
        int i, ret, lmac_cnt, umac_cnt, paging_cnt;
 
+       if (WARN(dram->paging,
+                "paging shouldn't already be initialized (%d pages)\n",
+                dram->paging_cnt))
+               iwl_pcie_ctxt_info_free_paging(trans);
+
        lmac_cnt = iwl_pcie_get_num_sections(fw, 0);
        /* add 1 due to separator */
        umac_cnt = iwl_pcie_get_num_sections(fw, lmac_cnt + 1);