]> git.baikalelectronics.ru Git - kernel.git/commit
iwlwifi: pcie: fix memory leaks in iwl_pcie_ctxt_info_gen3_init
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Fri, 27 Sep 2019 20:56:04 +0000 (15:56 -0500)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Oct 2019 10:01:06 +0000 (13:01 +0300)
commitd36ff98ebd4a388fdf6c42b60bd4822a6337a940
tree3c9db4d6d36f6cf55cc11617c445384dfaa90f10
parent8b562b505d4943218a1b8cb99247c1c195f6cfb5
iwlwifi: pcie: fix memory leaks in iwl_pcie_ctxt_info_gen3_init

In iwl_pcie_ctxt_info_gen3_init there are cases that the allocated dma
memory is leaked in case of error.

DMA memories prph_scratch, prph_info, and ctxt_info_gen3 are allocated
and initialized to be later assigned to trans_pcie. But in any error case
before such assignment the allocated memories should be released.

First of such error cases happens when iwl_pcie_init_fw_sec fails.
Current implementation correctly releases prph_scratch. But in two
sunsequent error cases where dma_alloc_coherent may fail, such
releases are missing.

This commit adds release for prph_scratch when allocation for
prph_info fails, and adds releases for prph_scratch and prph_info when
allocation for ctxt_info_gen3 fails.

Fixes: 8e0717d3aea3 ("iwlwifi: pcie: support context information for 22560 devices")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c