[Intel-wired-lan] [PATCH iwl-net v2 1/5] i40e: serialize Tx timestamp skb ownership

Nowlin, Alexander alexander.nowlin at intel.com
Wed Sep 30 01:15:43 UTC 2026


> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of xuanqiang.luo at linux.dev
> Sent: Tuesday, August 4, 2026 11:51 PM
> To: intel-wired-lan at lists.osuosl.org; horms at kernel.org
> Cc: vadim.fedorenko at linux.dev; Nguyen, Anthony L <anthony.l.nguyen at intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel at intel.com>; andrew+netdev at lunn.ch; davem at davemloft.net; edumazet at google.com; kuba at kernel.org; pabeni at redhat.com; richardcochran at gmail.com; Kwapulinski, Piotr <piotr.kwapulinski at intel.com>; Kubalewski, Arkadiusz <arkadiusz.kubalewski at intel.com>; Loktionov, Aleksandr <aleksandr.loktionov at intel.com>; netdev at vger.kernel.org; Xuanqiang Luo <luoxuanqiang at kylinos.cn>
> Subject: [Intel-wired-lan] [PATCH iwl-net v2 1/5] i40e: serialize Tx timestamp skb ownership
> 
> From: Xuanqiang Luo <luoxuanqiang at kylinos.cn>
> 
> The Tx timestamp interrupt, watchdog, transmit error path, and PTP stop path can all release ptp_tx_skb. The existing in-progress bit serializes slot reservation, but does not protect the skb pointer. One path can therefore free the skb while another is still using it, causing a use-after-free or double free.
> 
> Add ptp_tx_lock to protect the timestamp slot. With all accesses serialized, use a non-NULL ptp_tx_skb as the single indication that the slot is occupied and remove the redundant in-progress bit. Publish and claim the skb under the lock, then complete or free it after unlocking.
> 
> Make the transmit error path claim the slot only when it still points to the skb whose transmission failed. This prevents delayed error cleanup from releasing a newer timestamp request after another path recycled the slot.
> 
> Fixes: 0bc0706b46cd ("i40e: check for Tx timestamp timeouts during watchdog")
> Signed-off-by: Xuanqiang Luo <luoxuanqiang at kylinos.cn>
> ---
>  drivers/net/ethernet/intel/i40e/i40e.h      |  3 +-
>  drivers/net/ethernet/intel/i40e/i40e_main.c |  1 +  drivers/net/ethernet/intel/i40e/i40e_ptp.c  | 55 ++++++++++++++-------  drivers/net/ethernet/intel/i40e/i40e_txrx.c | 38 ++++++++++----
>  4 files changed, 67 insertions(+), 30 deletions(-)

Tested-by: Alexander Nowlin <alexander.nowlin at intel.com>


More information about the Intel-wired-lan mailing list