public inbox for intel-wired-lan@osuosl.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failure
@ 2026-04-06  0:58 Matt Vollrath
  2026-04-07  9:42 ` Dawid Osuchowski
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Vollrath @ 2026-04-06  0:58 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Matt Vollrath

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>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 926d001b2150..f3de147aaddf 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failure
  2026-04-06  0:58 [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failure Matt Vollrath
@ 2026-04-07  9:42 ` Dawid Osuchowski
  2026-04-07 16:00   ` Matt Vollrath
  0 siblings, 1 reply; 3+ messages in thread
From: Dawid Osuchowski @ 2026-04-07  9:42 UTC (permalink / raw)
  To: Matt Vollrath, intel-wired-lan

On 2026-04-06 2:58 AM, Matt Vollrath wrote:

Hey Matt,

Thanks for the patch!

> 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>
> ---

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: stable@vger.kernel.org

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 | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index 926d001b2150..f3de147aaddf 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -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

>   	i40e_clear_interrupt_scheme(pf);
>   	kfree(pf->vsi);
>   err_switch_setup:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failure
  2026-04-07  9:42 ` Dawid Osuchowski
@ 2026-04-07 16:00   ` Matt Vollrath
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Vollrath @ 2026-04-07 16:00 UTC (permalink / raw)
  To: Dawid Osuchowski, intel-wired-lan

On 4/7/26 05:42, Dawid Osuchowski wrote:
> 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: stable@vger.kernel.org
> 
> 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 :)

Thanks Dawid, I'll do that.
mv


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-07 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06  0:58 [Intel-wired-lan] [PATCH net v2] i40e: Cleanup PTP registration on probe failure Matt Vollrath
2026-04-07  9:42 ` Dawid Osuchowski
2026-04-07 16:00   ` Matt Vollrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox