]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i40e: Cleanup PTP registration on probe failure
authorMatt Vollrath <tactii@gmail.com>
Wed, 6 May 2026 21:48:10 +0000 (14:48 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 May 2026 23:01:08 +0000 (16:01 -0700)
Fix two conditions which would leak PTP registration on probe failure:

1. i40e_setup_pf_switch can encounter an error in
   i40e_setup_pf_filter_control, call i40e_ptp_init, then return
   non-zero, sending i40e_probe to err_vsis.

2. i40e_setup_misc_vector can return non-zero, sending i40e_probe to
   err_vsis.

Both of these conditions have been present since PTP was introduced in
this driver.

Found with coccinelle.

Fixes: beb0dff1251db ("i40e: enable PTP")
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260506-jk-iwl-net-2026-05-04-v2-1-a5ea4dc837a9@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 028bd500603a5448dc1d8a8102b3899ba557f8a4..f06fcef644e5711ddd38ac81cf0ae0b8d85a0a75 100644 (file)
@@ -16108,6 +16108,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* Unwind what we've done if something failed in the setup */
 err_vsis:
        set_bit(__I40E_DOWN, pf->state);
+       i40e_ptp_stop(pf);
        i40e_clear_interrupt_scheme(pf);
        kfree(pf->vsi);
 err_switch_setup: