i40e: Cleanup PTP registration on probe failure
Subsystems (2)
PATCH v2 1/1 i40e: Cleanup PTP registration on probe failure
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.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
@@ -16109,6 +16109,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:
Signature · 1 line
2.43.0
On 2026-04-06 2:58 AM, Matt Vollrath wrote:
Hey Matt,
Thanks for the patch!
Quoted 9 lines
Fix two conditions which would leak PTP registration on probe failure:
1.
i40e_setup_pf_switchcan encounter an error ini40e_setup_pf_filter_control, calli40e_ptp_init, then return non-zero, sendingi40e_probetoerr_vsis.2.
i40e_setup_misc_vectorcan return non-zero, sendingi40e_probetoerr_vsis.
Quoted 8 lines
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 <[email protected]>---
In the future when sending to Intel-wired-lan (IWL) you should use either the iwl-net or iwl-next as the target tree, example based on this patch:
[PATCH iwl-net v2] i40e: Cleanup PTP registration on probe failure
iwl-net is for fixes (such as this patch), iwl-next for new features / refactors that don't need to be backported to stable kernels.
Given this is a fix you could also add in the commit msg:
Cc: [email protected]
that way it will be automatically picked up for backporting to currently maintained stable kernel versions by the -stable maintainers [1].
For future submissions, if you send a v2/v3/vX... you should put a changelog here of what has changed w.r.t. the previous revision. An example in this case:
v2:
* add Fixes tag
* change name of patch:
i40e: Cleanup PTP upon probe failure -> i40e: Cleanup PTP registration
on probe failure
The important bit is to do include the changelog below the '---', that way it will be disregarded by e.g. 'git am' and won't pollute the commit msg. Changelog is for reviewers only to quickly assess what to look for / what has changed :)
drivers/net/ethernet/intel/i40e/i40e_main.c static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · line 16112
Quoted 12 lines
drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/intel/i40e/i40e_main.c +1
-0@@ -16109,6 +16109,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);
As for the change itself I'm not a PTP expert but will try to ping someone internally to review your patch.
Thanks
~Dawid
[1] https://docs.kernel.org/process/stable-kernel-rules.html#option-1
Quoted 3 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +0
-0i40e_clear_interrupt_scheme (pf);kfree (pf->vsi); err_switch_setup:
Quoted 10 lines · Dawid Osuchowski
In the future when sending to Intel-wired-lan (IWL) you should use either the iwl-net or iwl-next as the target tree, example based on this patch:
[PATCH iwl-net v2] i40e: Cleanup PTP registration on probe failureiwl-net is for fixes (such as this patch), iwl-next for new features / refactors that don't need to be backported to stable kernels.
Given this is a fix you could also add in the commit msg:
Cc: [email protected]that way it will be automatically picked up for backporting to currently maintained stable kernel versions by the -stable maintainers [1].
Quoted 8 lines
For future submissions, if you send a v2/v3/vX... you should put a changelog here of what has changed w.r.t. the previous revision. An example in this case:
v2:
* add Fixes tag
* change name of patch:
i40e: Cleanup PTP upon probe failure -> i40e: Cleanup PTP registration on probe failureThe important bit is to do include the changelog below the '---', that way it will be disregarded by e.g. 'git am' and won't pollute the commit msg. Changelog is for reviewers only to quickly assess what to look for / what has changed :)
Thanks Dawid, I'll do that.
mv
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Matt Vollrath
Sent: Sunday, April 5, 2026 5:59 PM
To: [email protected]
Cc: Matt Vollrath <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failureFix two conditions which would leak PTP registration on probe failure:
1.
i40e_setup_pf_switchcan encounter an error ini40e_setup_pf_filter_control, calli40e_ptp_init, then return non-zero, sendingi40e_probetoerr_vsis.2.
i40e_setup_misc_vectorcan return non-zero, sendingi40e_probetoerr_vsis.Both of these conditions have been present since PTP was introduced in this driver.
Quoted 7 lines
Found with coccinelle.
Fixes beb0dff1251db ("i40e: enable PTP")Signed-off-by Matt Vollrath <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + 1 file changed, 1 insertion(+)
Quoted 44 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Matt Vollrath
Sent: Monday, April 6, 2026 2:59 AM
To: [email protected]
Cc: Matt Vollrath <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failureFix two conditions which would leak PTP registration on probe failure:
1.
i40e_setup_pf_switchcan encounter an error ini40e_setup_pf_filter_control, calli40e_ptp_init, then return non-zero, sendingi40e_probetoerr_vsis.2.
i40e_setup_misc_vectorcan return non-zero, sendingi40e_probetoerr_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 <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + 1 file changed, 1 insertion(+)drivers/net/ethernet/intel/i40e/i40e_main.c +1
-0@@ -16109,6 +16109,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);
Quoted 3 lines
err_switch_setup:
--
2.43.0