Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: rfi: fix potential response leaks
Browse files Browse the repository at this point in the history
If the rx payload length check fails, or if kmemdup() fails,
we still need to free the command response. Fix that.

Fixes: 2125490 ("iwlwifi: mvm: add RFI-M support")
Co-authored-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240319100755.db2fa0196aa7.I116293b132502ac68a65527330fa37799694b79c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
jmberg-intel and panjaney committed Mar 25, 2024
1 parent 134d715 commit 06a0938
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,18 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
if (ret)
return ERR_PTR(ret);

if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size))
if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) !=
resp_size)) {
iwl_free_resp(&cmd);
return ERR_PTR(-EIO);
}

resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL);
iwl_free_resp(&cmd);

if (!resp)
return ERR_PTR(-ENOMEM);

iwl_free_resp(&cmd);
return resp;
}

Expand Down

0 comments on commit 06a0938

Please sign in to comment.