From: sashiko-bot@kernel.org
To: "Stan Iliev" <stani@google.com>, intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion
Date: Wed, 18 Nov 2026 16:29:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-221490@kernel.org> (raw)
In-Reply-To: <20261117145522.1910636-13-stani@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] idpf: psp: race on keys_lost in idpf_psp_recv_late_reply() on
timeout
--
commit 4b0d48dccce789bdff76728f6f4499fe7e727901
Author: Stan Iliev <stani@google.com>
idpf: psp: add support for psp tx key deletion
This commit adds virtchnl definitions and driver support for queueing and
sending VIRTCHNL2_OP_PSP_DELETE_KEYS requests to delete PSP TX keys from
the SADB, including retry and late-reply accounting.
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
> index d36f46a46cfd7..42a7d74db2328 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
> @@ -402,24 +402,197 @@ int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
> return err;
> }
>
> +/**
> + * idpf_psp_delete_done - Release the TX keys of a deletion request
> + * @adapter: Driver specific private structure
> + * @batch: TX keys of the request
> + * @removed: number of SA indexes the CP deleted
> + * @lost: number of SA indexes that couldn't be deleted
> + */
> +static void idpf_psp_delete_done(struct idpf_adapter *adapter,
> + struct list_head *batch, u32 removed,
> + u32 lost)
> +{
> + struct idpf_psp_tx_key *key, *tmp;
> +
> + atomic_add(removed, &adapter->psp.keys_removed);
> + if (lost) {
> + atomic_add(lost, &adapter->psp.keys_lost);
> + net_warn_ratelimited("%s: %u SA indexes couldn't be deleted\n",
> + __func__, lost);
> + }
[ ... ]
> + case -ETIMEDOUT:
> + break;
> + default:
> + goto requeue;
> + }
> +
> + /* The request timed out, or failed again on its own */
> + idpf_psp_delete_done(adapter, &batch, 0, num_keys);
> +
> + return more;
[ ... ]
> void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
> const struct libie_ctlq_msg *ctlq_msg)
> {
> const struct kvec *buff = &ctlq_msg->recv_mem;
> + const struct virtchnl2_psp_delete_keys_response *del_resp;
> + u32 deleted;
>
> switch (ctlq_msg->chnl_opcode) {
> case VIRTCHNL2_OP_PSP_ALLOCATE_KEYS:
> if (buff->iov_base)
> memzero_explicit(buff->iov_base, buff->iov_len);
> break;
> + case VIRTCHNL2_OP_PSP_DELETE_KEYS:
> + del_resp = buff->iov_base;
> + if (!idpf_is_psp_ena(adapter) || ctlq_msg->chnl_retval ||
> + !del_resp || buff->iov_len < sizeof(*del_resp))
> + break;
> +
> + /* Only the SA indexes counted as lost since the last core
> + * init, the counters were reset by a reset meanwhile
> + */
> + deleted = min_t(u32, le32_to_cpu(del_resp->num_sa_indexes_deleted),
> + max(atomic_read(&adapter->psp.keys_lost), 0));
> + atomic_sub(deleted, &adapter->psp.keys_lost);
> + atomic_add(deleted, &adapter->psp.keys_removed);
> + break;
[Severity: Medium]
Can idpf_psp_recv_late_reply() read adapter->psp.keys_lost before
idpf_send_delete_psp_keys() adds the timed-out request's keys to it?
When wait_for_completion_timeout() expires in libie_ctlq_xn_send(), it marks
the transaction LIBIE_CTLQ_XN_IDLE and drops xn->xn_lock before returning
-ETIMEDOUT to idpf_send_delete_psp_keys():
CPU0 CPU1 (adapter->mbx_wq)
idpf_send_delete_psp_keys()
idpf_send_mb_msg_kfree()
...
libie_ctlq_xn_send()
spin_lock(&xn->xn_lock)
xn->state = LIBIE_CTLQ_XN_IDLE
spin_unlock(&xn->xn_lock)
idpf_mbx_task()
...
idpf_psp_recv_late_reply()
atomic_read(&psp->keys_lost)
--> 0, clamps deleted to 0
idpf_psp_delete_done()
atomic_add(lost, &psp->keys_lost)
Because idpf_psp_recv_late_reply() clamps deleted to keys_lost before
idpf_psp_delete_done() adds num_keys, the deleted SA indexes are ignored by
the late reply and remain permanently counted in keys_lost instead of
keys_removed.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117145522.1910636-1-stani@google.com?part=12
next prev 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
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 [this message]
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-221490@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.