Commit a3f8c0a2 authored by Milena Olech's avatar Milena Olech Committed by Jakub Kicinski
Browse files

idpf: cleanup remaining SKBs in PTP flows



When the driver requests Tx timestamp value, one of the first steps is
to clone SKB using skb_get. It increases the reference counter for that
SKB to prevent unexpected freeing by another component.
However, there may be a case where the index is requested, SKB is
assigned and never consumed by PTP flows - for example due to reset during
running PTP apps.

Add a check in release timestamping function to verify if the SKB
assigned to Tx timestamp latch was freed, and release remaining SKBs.

Fixes: 4901e83a ("idpf: add Tx timestamp capabilities negotiation")
Signed-off-by: default avatarMilena Olech <milena.olech@intel.com>
Signed-off-by: default avatarAnton Nadezhdin <anton.nadezhdin@intel.com>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: default avatarSamuel Salin <Samuel.salin@intel.com>
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20251009-jk-iwl-net-2025-10-01-v3-1-ef32a425b92a@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 21f4d45e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -863,6 +863,9 @@ static void idpf_ptp_release_vport_tstamp(struct idpf_vport *vport)
		u64_stats_inc(&vport->tstamp_stats.flushed);

		list_del(&ptp_tx_tstamp->list_member);
		if (ptp_tx_tstamp->skb)
			consume_skb(ptp_tx_tstamp->skb);

		kfree(ptp_tx_tstamp);
	}
	u64_stats_update_end(&vport->tstamp_stats.stats_sync);
+1 −0
Original line number Diff line number Diff line
@@ -517,6 +517,7 @@ idpf_ptp_get_tstamp_value(struct idpf_vport *vport,
	shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
	skb_tstamp_tx(ptp_tx_tstamp->skb, &shhwtstamps);
	consume_skb(ptp_tx_tstamp->skb);
	ptp_tx_tstamp->skb = NULL;

	list_add(&ptp_tx_tstamp->list_member,
		 &tx_tstamp_caps->latches_free);