mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
wifi: iwlwifi: mld: avoid memory leak if mcc_init fails
allocating mld->nvm_data used to be the last thing done in iwl_mld_load_fw, so there was no need to free on any error path of iwl_mld_load_fw. But now iwl_mld_load_fw also calls iwl_mld_init_mcc, that can fail, after allocating nvm->data. In that case, it is not freed. As allocating the NVM data should only be done at op mode start anyway, simply move it to there, where it is already freed in the right error paths. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20250423091408.d07469f866ac.I84ad2e624ce7cd4a661c73b4942186e50cdf82b2@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
834f6811af
commit
092e9ca61f
|
|
@ -11,7 +11,6 @@
|
|||
#include "fw/dbg.h"
|
||||
#include "fw/pnvm.h"
|
||||
#include "hcmd.h"
|
||||
#include "iwl-nvm-parse.h"
|
||||
#include "power.h"
|
||||
#include "mcc.h"
|
||||
#include "led.h"
|
||||
|
|
@ -308,16 +307,6 @@ static int iwl_mld_run_fw_init_sequence(struct iwl_mld *mld)
|
|||
goto init_failure;
|
||||
}
|
||||
|
||||
if (!mld->nvm_data) {
|
||||
mld->nvm_data = iwl_get_nvm(mld->trans, mld->fw, 0, 0);
|
||||
if (IS_ERR(mld->nvm_data)) {
|
||||
ret = PTR_ERR(mld->nvm_data);
|
||||
mld->nvm_data = NULL;
|
||||
IWL_ERR(mld, "Failed to read NVM: %d\n", ret);
|
||||
goto init_failure;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
init_failure:
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "hcmd.h"
|
||||
#include "fw/api/location.h"
|
||||
|
||||
#include "iwl-nvm-parse.h"
|
||||
|
||||
#define DRV_DESCRIPTION "Intel(R) MLD wireless driver for Linux"
|
||||
MODULE_DESCRIPTION(DRV_DESCRIPTION);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -412,6 +414,14 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!ret) {
|
||||
mld->nvm_data = iwl_get_nvm(mld->trans, mld->fw, 0, 0);
|
||||
if (IS_ERR(mld->nvm_data)) {
|
||||
IWL_ERR(mld, "Failed to read NVM: %d\n", ret);
|
||||
ret = PTR_ERR(mld->nvm_data);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
wiphy_unlock(mld->wiphy);
|
||||
rtnl_unlock();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user