summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-04-19 10:30:47 +0200
committerLuca Coelho <luciano.coelho@intel.com>2017-04-20 07:28:03 +0300
commit718ceb22a0ccd0b3a02a4bd401d944a1eb16f3ce (patch)
treec15b167d14eac331b0ac68ad3f335d92a4032a6c /drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
parent97b00d877bb8c2e499b9d0c07b65bd92b4e91ddd (diff)
downloadtalos-op-linux-718ceb22a0ccd0b3a02a4bd401d944a1eb16f3ce.tar.gz
talos-op-linux-718ceb22a0ccd0b3a02a4bd401d944a1eb16f3ce.zip
iwlwifi: pcie: free context info in case of failures
If iwl_pcie_ctxt_info_init_fw_sec() fails, the previous allocated DMA memory needs to be freed (it even goes out of scope immediately.) Do that to prevent the leak. Fixes: eda50cde58de ("iwlwifi: pcie: add context information support") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
index 854d61888f4d..1d95512361b2 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
@@ -241,8 +241,11 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
/* allocate ucode sections in dram and set addresses */
ret = iwl_pcie_ctxt_info_init_fw_sec(trans, fw, ctxt_info);
- if (ret)
+ if (ret) {
+ dma_free_coherent(trans->dev, sizeof(*trans_pcie->ctxt_info),
+ ctxt_info, trans_pcie->ctxt_info_dma_addr);
return ret;
+ }
trans_pcie->ctxt_info = ctxt_info;
OpenPOWER on IntegriCloud