From: Moshe Harel Date: Thu, 10 Sep 2015 12:29:09 +0000 (+0300) Subject: iwlwifi: nvm: free old section data when reading nvm file X-Git-Tag: KARO-TX6UL-2015-11-03~90^2~6^2~11^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2edb7a3372c76c9379d0fc00e4274ea8f018248a;p=karo-tx-linux.git iwlwifi: nvm: free old section data when reading nvm file When reading external NVM file, if a section exists both in OTP and in the external file, the memory that was allocated at OTP reading is not freed. This is possible only on systems that have an external NVM file which is typically the case on embedded systems. Signed-off-by: Moshe Harel Signed-off-by: Emmanuel Grumbach --- diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c index 4e4a680f274a..2ee0f6fe56a1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/nvm.c +++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c @@ -483,6 +483,7 @@ static int iwl_mvm_read_external_nvm(struct iwl_mvm *mvm) ret = -ENOMEM; break; } + kfree(mvm->nvm_sections[section_id].data); mvm->nvm_sections[section_id].data = temp; mvm->nvm_sections[section_id].length = section_size;