Skip to content

Commit b0b07e0

Browse files
Junjie650gregkh
authored andcommitted
wifi: iwlwifi: mld: fix race condition in PTP removal
commit e1fc085 upstream. iwl_mld_ptp_remove() calls cancel_delayed_work_sync() only after ptp_clock_unregister() and clearing ptp_data state (ptp_clock, last_gp2, wrap_counter). This creates a race where the delayed work iwl_mld_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-2-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 df626f2 commit b0b07e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/wireless/intel/iwlwifi/mld

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ void iwl_mld_ptp_remove(struct iwl_mld *mld)
319319
mld->ptp_data.ptp_clock_info.name,
320320
ptp_clock_index(mld->ptp_data.ptp_clock));
321321

322+
cancel_delayed_work_sync(&mld->ptp_data.dwork);
322323
ptp_clock_unregister(mld->ptp_data.ptp_clock);
323324
mld->ptp_data.ptp_clock = NULL;
324325
mld->ptp_data.last_gp2 = 0;
325326
mld->ptp_data.wrap_counter = 0;
326-
cancel_delayed_work_sync(&mld->ptp_data.dwork);
327327
}
328328
}

0 commit comments

Comments
 (0)