wifi: iwlwifi: fw: don't always use FW dump trig

commit 045a5b645d upstream.

Since the dump_data (struct iwl_fwrt_dump_data) is a union,
it's not safe to unconditionally access and use the 'trig'
member, it might be 'desc' instead. Access it only if it's
known to be 'trig' rather than 'desc', i.e. if ini-debug
is present.

Cc: stable@vger.kernel.org
Fixes: 0eb50c674a ("iwlwifi: yoyo: send hcmd to fw after dump collection completes.")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240319100755.e2976bc58b29.I72fbd6135b3623227de53d8a2bb82776066cb72b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johannes Berg 2024-03-19 10:10:20 +02:00 committed by Greg Kroah-Hartman
parent 3d7ac02507
commit 566e540b40

View file

@ -2933,8 +2933,6 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
struct iwl_fw_dbg_params params = {0};
struct iwl_fwrt_dump_data *dump_data =
&fwrt->dump.wks[wk_idx].dump_data;
u32 policy;
u32 time_point;
if (!test_bit(wk_idx, &fwrt->dump.active_wks))
return;
@ -2965,13 +2963,16 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
iwl_fw_dbg_stop_restart_recording(fwrt, &params, false);
policy = le32_to_cpu(dump_data->trig->apply_policy);
time_point = le32_to_cpu(dump_data->trig->time_point);
if (iwl_trans_dbg_ini_valid(fwrt->trans)) {
u32 policy = le32_to_cpu(dump_data->trig->apply_policy);
u32 time_point = le32_to_cpu(dump_data->trig->time_point);
if (policy & IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD) {
IWL_DEBUG_FW_INFO(fwrt, "WRT: sending dump complete\n");
iwl_send_dbg_dump_complete_cmd(fwrt, time_point, 0);
if (policy & IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD) {
IWL_DEBUG_FW_INFO(fwrt, "WRT: sending dump complete\n");
iwl_send_dbg_dump_complete_cmd(fwrt, time_point, 0);
}
}
if (fwrt->trans->dbg.last_tp_resetfw == IWL_FW_INI_RESET_FW_MODE_STOP_FW_ONLY)
iwl_force_nmi(fwrt->trans);