Skip to content

Commit 07a6e3b

Browse files
gabaydjmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: Fix response handling in iwl_mvm_send_recovery_cmd()
1. The size of the response packet is not validated. 2. The response buffer is not freed. Resolve these issues by switching to iwl_mvm_send_cmd_status(), which handles both size validation and frees the buffer. Fixes: f130bb7 ("iwlwifi: add FW recovery flow") Signed-off-by: Daniel Gabay <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20241010140328.76c73185951e.Id3b6ca82ced2081f5ee4f33c997491d0ebda83f7@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 32d95ab commit 07a6e3b

File tree

1 file changed

+4
-6
lines changed
  • drivers/net/wireless/intel/iwlwifi/mvm

1 file changed

+4
-6
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/fw.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,16 +1307,15 @@ static void iwl_mvm_disconnect_iterator(void *data, u8 *mac,
13071307
void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
13081308
{
13091309
u32 error_log_size = mvm->fw->ucode_capa.error_log_size;
1310+
u32 status = 0;
13101311
int ret;
1311-
u32 resp;
13121312

13131313
struct iwl_fw_error_recovery_cmd recovery_cmd = {
13141314
.flags = cpu_to_le32(flags),
13151315
.buf_size = 0,
13161316
};
13171317
struct iwl_host_cmd host_cmd = {
13181318
.id = WIDE_ID(SYSTEM_GROUP, FW_ERROR_RECOVERY_CMD),
1319-
.flags = CMD_WANT_SKB,
13201319
.data = {&recovery_cmd, },
13211320
.len = {sizeof(recovery_cmd), },
13221321
};
@@ -1336,7 +1335,7 @@ void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
13361335
recovery_cmd.buf_size = cpu_to_le32(error_log_size);
13371336
}
13381337

1339-
ret = iwl_mvm_send_cmd(mvm, &host_cmd);
1338+
ret = iwl_mvm_send_cmd_status(mvm, &host_cmd, &status);
13401339
kfree(mvm->error_recovery_buf);
13411340
mvm->error_recovery_buf = NULL;
13421341

@@ -1347,11 +1346,10 @@ void iwl_mvm_send_recovery_cmd(struct iwl_mvm *mvm, u32 flags)
13471346

13481347
/* skb respond is only relevant in ERROR_RECOVERY_UPDATE_DB */
13491348
if (flags & ERROR_RECOVERY_UPDATE_DB) {
1350-
resp = le32_to_cpu(*(__le32 *)host_cmd.resp_pkt->data);
1351-
if (resp) {
1349+
if (status) {
13521350
IWL_ERR(mvm,
13531351
"Failed to send recovery cmd blob was invalid %d\n",
1354-
resp);
1352+
status);
13551353

13561354
ieee80211_iterate_interfaces(mvm->hw, 0,
13571355
iwl_mvm_disconnect_iterator,

0 commit comments

Comments
 (0)