]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i40e: Cleanup PTP pins on probe failure
authorMatt Vollrath <tactii@gmail.com>
Wed, 6 May 2026 21:48:11 +0000 (14:48 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 May 2026 23:01:08 +0000 (16:01 -0700)
PTP pin structs are allocated early in probe, but never cleaned up.

Fix this by calling i40e_ptp_free_pins in the error path.

To support this, i40e_ptp_free_pins is added to the header and
pin_config is correctly nullified after being freed.

This has been an issue since i40e_ptp_alloc_pins was introduced.

Fixes: 1050713026a08 ("i40e: add support for PTP external synchronization clock")
Reported-by: Kohei Enju <kohei@enjuk.jp>
Cc: stable@vger.kernel.org
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Kohei Enju <kohei@enjuk.jp>
Tested-by: Sunitha Mekala <sunithax.d.mekala@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-2-a5ea4dc837a9@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/i40e/i40e.h
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_ptp.c

index dcb50c2e1aa277d2fbdbeca852dc1f7394508eb8..83e780919ac97fd48cf1e11d6487cac1b0b1f813 100644 (file)
@@ -1318,6 +1318,7 @@ void i40e_ptp_restore_hw_time(struct i40e_pf *pf);
 void i40e_ptp_init(struct i40e_pf *pf);
 void i40e_ptp_stop(struct i40e_pf *pf);
 int i40e_ptp_alloc_pins(struct i40e_pf *pf);
+void i40e_ptp_free_pins(struct i40e_pf *pf);
 int i40e_update_adq_vsi_queues(struct i40e_vsi *vsi, int vsi_offset);
 int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
 int i40e_get_partition_bw_setting(struct i40e_pf *pf);
index f06fcef644e5711ddd38ac81cf0ae0b8d85a0a75..6d4f9218dc68475be4ca2c26329d6d6cf1e38bed 100644 (file)
@@ -16112,6 +16112,7 @@ err_vsis:
        i40e_clear_interrupt_scheme(pf);
        kfree(pf->vsi);
 err_switch_setup:
+       i40e_ptp_free_pins(pf);
        i40e_reset_interrupt_capability(pf);
        timer_shutdown_sync(&pf->service_timer);
 err_mac_addr:
index 404a716db8da71a1fda1359918c3a6bd08d9fd6d..7d07c389bb231241ff426f54909b2e8bf0f3d3fb 100644 (file)
@@ -940,12 +940,13 @@ int i40e_ptp_hwtstamp_get(struct net_device *netdev,
  *
  * Release memory allocated for PTP pins.
  **/
-static void i40e_ptp_free_pins(struct i40e_pf *pf)
+void i40e_ptp_free_pins(struct i40e_pf *pf)
 {
        if (i40e_is_ptp_pin_dev(&pf->hw)) {
                kfree(pf->ptp_pins);
                kfree(pf->ptp_caps.pin_config);
                pf->ptp_pins = NULL;
+               pf->ptp_caps.pin_config = NULL;
        }
 }