> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf Of > [email protected] > Sent: Tuesday, August 4, 2026 11:52 PM > To: [email protected]; [email protected] > Cc: [email protected]; Nguyen, Anthony L > <[email protected]>; Kitszel, Przemyslaw > <[email protected]>; [email protected]; [email protected]; > [email protected]; [email protected]; [email protected]; > [email protected]; Kwapulinski, Piotr <[email protected]>; > Kubalewski, Arkadiusz <[email protected]>; Loktionov, Aleksandr > <[email protected]>; [email protected]; Xuanqiang Luo > <[email protected]> > Subject: [Intel-wired-lan] [PATCH iwl-net v2 5/5] i40e: fix races in PTP > external timestamp work handling > > From: Xuanqiang Luo <[email protected]> > > The time sync interrupt queues ptp_extts0_work, which reads device registers > and reports events through pf->ptp_clock. i40e_ptp_stop() unregisters the PHC > before disabling the event source or draining the work. The worker can > therefore use the clock or PF after either has been freed. > > Move the event-source shutdown before PHC unregister. i40e_ptp_stop() first > clears I40E_FLAG_PTP_ENA under ptp_config_lock, so timestamp configuration > cannot re-enable the source after the lock is released. > Then call disable_work_sync() to reject later queue attempts and drain work > already pending or running. > > INIT_WORK() is currently called from i40e_ptp_set_timestamp_mode(), which > runs on reset and whenever timestamping is reconfigured. Reinitializing > pending or running work can corrupt its workqueue state. > Initialize the > work once from i40e_sw_init() instead. > > Fixes: 1050713026a0 ("i40e: add support for PTP external synchronization > clock") > Signed-off-by: Xuanqiang Luo <[email protected]> > --- > drivers/net/ethernet/intel/i40e/i40e.h | 1 + > drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + > drivers/net/ethernet/intel/i40e/i40e_ptp.c | 25 +++++++++++++++------ > 3 files changed, 20 insertions(+), 7 deletions(-)
Tested-by: Alexander Nowlin <[email protected]>
