]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: trans: cancel restart work on op mode leave
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Thu, 6 Mar 2025 10:25:48 +0000 (12:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 7 Mar 2025 08:57:39 +0000 (09:57 +0100)
If the restart work happens to run after the opmode left
(i.e. called iwl_trans_op_mode_leave), then the opmode memory (including
its mutex) is likely to be freed already, and trans->opmode is NULL.

Although the hw is stopped in that stage, which means that this restart
got aborted (i.e. STATUS_RESET_PENDING will be cleared),
it still can access trans->opmode (NULL pointer dereference)
or the opmodes memory (which is freed).

Fix this by canceling the restart wk in iwl_trans_op_mode_leave.
Also make sure that the restart wk is really aborted.

Fixes: 7391b2a4f7db ("wifi: iwlwifi: rework firmware error handling")
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Link: https://patch.msgid.link/20250306122425.801301ba1b8b.I6f6143f550b6335b699920c5d4b2b78449607a96@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-trans.c

index 49c8507d1a6b186305bebf61eef7056f2fbfaca5..47854a36413e174c93894ed6fdcde3dad3efeb8d 100644 (file)
@@ -403,6 +403,8 @@ void iwl_trans_op_mode_leave(struct iwl_trans *trans)
 
        iwl_trans_pcie_op_mode_leave(trans);
 
+       cancel_work_sync(&trans->restart.wk);
+
        trans->op_mode = NULL;
 
        trans->state = IWL_TRANS_NO_FW;