Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Stan Iliev" <stani@google.com>, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion
Date: Wed, 18 Nov 2026 16:29:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-221491@kernel.org> (raw)
In-Reply-To: <20261117145522.1910636-14-stani@google.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 2 related pre-existing issues it does not
introduce:
- [Critical] idpf: double free of vport->txqs in
  idpf_initiate_soft_reset() [1]
- [Critical] idpf: use-after-free in
  idpf_ptp_get_txq_tstamp_capability() [2]
--

commit 1bdbc7bd2b7486c90a1b74658932d35032195933
Author: Stan Iliev <stani@google.com>

idpf: psp: add psp work and tx key insertion completion

This commit adds delayed work to send queued PSP key deletion requests and
implements completion handling, timeout recovery, and quiescing for
asynchronous TX key insertion requests.

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index 062753a62f593..18d484c1a2cad 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
[ ... ]
> @@ -1882,6 +1888,11 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
>  	if (!new_vport)
>  		return -ENOMEM;
>  
> +	/* No PSP packet is sent while the queues are reallocated, the PSP
> +	 * work is queued again below
> +	 */
> +	idpf_cancel_psp_work(adapter);
> +
>  	/* This purposely avoids copying the end of the struct because it
>  	 * contains wait_queues and mutexes and other stuff we don't want to
>  	 * mess with. Nothing below should use those variables from new_vport
> @@ -1970,6 +1981,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
>  
>  free_vport:
>  	kfree(new_vport);
> +	idpf_queue_psp_work(adapter);
>  
>  	if (reset_cause == IDPF_SR_MTU_CHANGE)
>  		idpf_idc_vdev_mtu_event(vport->vdev_info,

[Severity: Critical]
This problem wasn't introduced by this patch, but can
idpf_initiate_soft_reset() cause a double free of vport->txqs [1]?

After copying vport into new_vport, idpf_vport_stop() calls
idpf_vport_queues_rel(), which frees vport->txqs and sets it to NULL, while
only new_rsrc->rxq_grps is cleared in the clone:

drivers/net/ethernet/intel/idpf/idpf_lib.c:idpf_initiate_soft_reset() {
	...
	memcpy(new_vport, vport, offsetof(struct idpf_vport, link_up));
	...
	} else {
		set_bit(IDPF_VPORT_DEL_QUEUES, vport->flags);
		idpf_vport_stop(vport, false);

		/* Drop the stale pointer in the clone, as rxq_grps was freed
		 * by idpf_vport_stop().
		 */
		new_rsrc->rxq_grps = NULL;
	}
	...
	memcpy(vport, new_vport, offsetof(struct idpf_vport, link_up));
	...
}

The second memcpy() writes the freed vport->txqs pointer from new_vport
back into vport.  If idpf_set_real_num_queues() or idpf_vport_open() fails
before reallocating the queues, the dangling vport->txqs pointer remains in
vport and is freed a second time when idpf_vport_queues_alloc() later fails
into idpf_vport_queues_rel().

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 90fe5212095df..bff3b0f46113e 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3281,6 +3281,9 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
>  	if (remove_in_prog)
>  		libie_ctlq_xn_shutdown(adapter->xnm);
>  
> +	/* The mailbox transactions were shut down in both cases */
> +	idpf_psp_quiesce(adapter);
> +
>  	cancel_delayed_work_sync(&adapter->serv_task);
>  	cancel_delayed_work_sync(&adapter->mbx_task);

[Severity: Critical]
This problem wasn't introduced by this patch, but can
idpf_ptp_get_txq_tstamp_capability() trigger a use-after-free on
txq->cached_tstamp_caps during teardown [2]?

In idpf_vc_core_deinit(), idpf_ptp_release() frees vport->tx_tstamp_caps
before idpf_deinit_task() stops the vports and netdevs, while
txq->cached_tstamp_caps on active TX queues still points to it:

CPU0                                  CPU1
idpf_vc_core_deinit()
  idpf_ptp_release()
    idpf_ptp_release_vport_tstamp()
      kfree(vport->tx_tstamp_caps)
                                      idpf_tx_start()
                                        ...
                                          idpf_ptp_get_txq_tstamp_capability()
                                            txq->cached_tstamp_caps->access
                                              <-- use-after-free
  idpf_deinit_task()

[1] https://sashiko.dev/#/bug/linux-2cb96bfd-fe1d-4dd4-ba7f-97cce6b47ab6
[2] https://sashiko.dev/#/bug/linux-6f8f8f90-94e3-4193-85dc-3ce7d6f00653

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117145522.1910636-1-stani@google.com?part=13

  reply	other threads:[~2026-11-18 16:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 02/15] idpf: wipe mailbox " Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization Stan Iliev
2026-11-17 17:34   ` Daniel Zahka
2026-11-18 16:29   ` sashiko-bot
2026-11-17 14:55 ` [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status Stan Iliev
2026-11-17 20:40   ` Daniel Zahka
2026-11-17 14:55 ` [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation Stan Iliev
2026-11-17 20:57   ` Daniel Zahka
2026-11-18 16:29   ` sashiko-bot
2026-11-17 14:55 ` [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation Stan Iliev
2026-11-17 22:15   ` Daniel Zahka
2026-11-17 14:55 ` [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 11/15] idpf: psp: add psp tx key state Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion Stan Iliev
2026-11-18 16:29   ` sashiko-bot
2026-11-17 14:55 ` [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion Stan Iliev
2026-11-18 16:29   ` sashiko-bot [this message]
2026-11-17 14:55 ` [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration Stan Iliev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-221491@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stani@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox