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 04/15] idpf: psp: add psp offload initialization
Date: Wed, 18 Nov 2026 16:29:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-221482@kernel.org> (raw)
In-Reply-To: <20261117145522.1910636-5-stani@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] idpf: psp: use-after-free on netdev in idpf_remove() via
  idpf_psp_free()
--

commit 77673bf9c57703b770d88ecaf99ce33c90db8e20
Author: Stan Iliev <stani@google.com>

idpf: psp: add psp offload initialization

This commit adds PSP offload capability negotiation and initialization, along
with helpers to register and unregister the PSP device.

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
> index 566d5804c8c10..2fab58f4b02b7 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_main.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c

[ ... ]

> @@ -180,6 +181,7 @@ static void idpf_remove(struct pci_dev *pdev)
>  	}
>  	kfree(adapter->vport_config);
>  	adapter->vport_config = NULL;
> +	idpf_psp_free(adapter);
>  	kfree(adapter->netdevs);
>  	adapter->netdevs = NULL;

[Severity: Medium]
Once idpf_psp_register() is wired up, can calling idpf_psp_free() at this
point in idpf_remove() cause a use-after-free on adapter->netdevs[0]?

idpf_psp_free() calls idpf_psp_unregister() -> psp_dev_unregister(psd), which
dereferences psd->main_netdev (adapter->netdevs[0]) in psp_nl_notify_dev()
and writes NULL to psd->main_netdev->psp_dev:

net/psp/psp_main.c:psp_dev_unregister() {
	...
	psp_nl_notify_dev(psd, PSP_CMD_DEV_DEL_NTF);
	...
	rcu_assign_pointer(psd->main_netdev->psp_dev, NULL);
}

In idpf_remove(), however, the net_device structs in adapter->netdevs[] have
already been unregistered and freed by free_netdev() during
idpf_vc_core_deinit() or the cleanup loop above destroy_wqs, and
kfree(adapter->netdevs) here only frees the pointer array.

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

  parent 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 [this message]
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
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-221482@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