Skip to content

Commit df626f2

Browse files
Junjie650gregkh
authored andcommitted
wifi: iwlwifi: mvm: fix race condition in PTP removal
commit 65150c9 upstream. iwl_mvm_ptp_remove() calls cancel_delayed_work_sync() only after ptp_clock_unregister() and clearing ptp_data state (ptp_clock, ptp_clock_info, last_gp2). This creates a race where the delayed work iwl_mvm_ptp_work() can execute between ptp_clock_unregister() and cancel_delayed_work_sync(), observing partially cleared PTP state. Move cancel_delayed_work_sync() before ptp_clock_unregister() to ensure the delayed work is fully stopped before any PTP cleanup begins. Cc: stable@vger.kernel.org Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Signed-off-by: Junjie Cao <junjie.cao@intel.com> Link: https://patch.msgid.link/20260212125035.1345718-1-junjie.cao@intel.com Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 200d58c commit df626f2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/intel/iwlwifi/mvm

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ void iwl_mvm_ptp_remove(struct iwl_mvm *mvm)
323323
mvm->ptp_data.ptp_clock_info.name,
324324
ptp_clock_index(mvm->ptp_data.ptp_clock));
325325

326+
cancel_delayed_work_sync(&mvm->ptp_data.dwork);
326327
ptp_clock_unregister(mvm->ptp_data.ptp_clock);
327328
mvm->ptp_data.ptp_clock = NULL;
328329
memset(&mvm->ptp_data.ptp_clock_info, 0,
329330
sizeof(mvm->ptp_data.ptp_clock_info));
330331
mvm->ptp_data.last_gp2 = 0;
331-
cancel_delayed_work_sync(&mvm->ptp_data.dwork);
332332
}
333333
}

0 commit comments

Comments
 (0)