Skip to content

Commit 2c84e91

Browse files
mwolechgregkh
authored andcommitted
idpf: cleanup remaining SKBs in PTP flows
[ Upstream commit a3f8c0a ] 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: 4901e83 ("idpf: add Tx timestamp capabilities negotiation") Signed-off-by: Milena Olech <milena.olech@intel.com> Signed-off-by: Anton Nadezhdin <anton.nadezhdin@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Tested-by: Samuel Salin <Samuel.salin@intel.com> Signed-off-by: Jacob 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: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b6eb25d commit 2c84e91

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

drivers/net/ethernet/intel/idpf/idpf_ptp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,9 @@ static void idpf_ptp_release_vport_tstamp(struct idpf_vport *vport)
855855
head = &vport->tx_tstamp_caps->latches_in_use;
856856
list_for_each_entry_safe(ptp_tx_tstamp, tmp, head, list_member) {
857857
list_del(&ptp_tx_tstamp->list_member);
858+
if (ptp_tx_tstamp->skb)
859+
consume_skb(ptp_tx_tstamp->skb);
860+
858861
kfree(ptp_tx_tstamp);
859862
}
860863

drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ idpf_ptp_get_tstamp_value(struct idpf_vport *vport,
517517
shhwtstamps.hwtstamp = ns_to_ktime(tstamp);
518518
skb_tstamp_tx(ptp_tx_tstamp->skb, &shhwtstamps);
519519
consume_skb(ptp_tx_tstamp->skb);
520+
ptp_tx_tstamp->skb = NULL;
520521

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

0 commit comments

Comments
 (0)