]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
idpf: cleanup remaining SKBs in PTP flows
authorMilena Olech <milena.olech@intel.com>
Fri, 10 Oct 2025 00:03:46 +0000 (17:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2025 14:24:29 +0000 (16:24 +0200)
[ Upstream commit a3f8c0a273120fd2638f03403e786c3de2382e72 ]

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: 4901e83a94ef ("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>
drivers/net/ethernet/intel/idpf/idpf_ptp.c
drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c

index ee21f2ff0cad9884008014547505e397258810b3..63a41e688733bc5e957ad94a6b121e4e5e7e7df3 100644 (file)
@@ -855,6 +855,9 @@ static void idpf_ptp_release_vport_tstamp(struct idpf_vport *vport)
        head = &vport->tx_tstamp_caps->latches_in_use;
        list_for_each_entry_safe(ptp_tx_tstamp, tmp, head, list_member) {
                list_del(&ptp_tx_tstamp->list_member);
+               if (ptp_tx_tstamp->skb)
+                       consume_skb(ptp_tx_tstamp->skb);
+
                kfree(ptp_tx_tstamp);
        }
 
index 4f1fb0cefe516d45c0b47ac4029c62f2badec5ba..688a6f4e0acc8104f69940c74543735aed2a7083 100644 (file)
@@ -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);