From: sashiko-bot@kernel.org
To: "Todd Freed" <toddfreed@meta.com>
Cc: linux-rdma@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a psp association on an skb
Date: Wed, 25 Nov 2026 22:19:40 +0000 [thread overview]
Message-ID: <sashiko-outbox-234240@kernel.org> (raw)
In-Reply-To: <20261124221758.3230929-6-toddfreed@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: skipped sk_validate_xmit_skb() on gso_skb requeue in
dequeue_skb()
--
commit 8a561ec981f5fecca95918e822dec6211fad4e8e
Author: Todd Freed <toddfreed@meta.com>
net: add METADATA_PSP dst to carry a psp association on an skb
This commit adds a METADATA_PSP metadata_dst type to carry a PSP
association on socket-less skbs and validates it in __dev_queue_xmit()
and sk_validate_xmit_skb().
> diff --git a/net/core/dev.c b/net/core/dev.c
> index a44b314f387bb..2b1a2736ab3f9 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -4156,13 +4162,32 @@ static struct sk_buff *sk_validate_xmit_skb(struct sk_buff *skb,
> sk_validate = NULL;
> if (sk) {
> if (sk_fullsock(sk))
> - sk_validate = sk->sk_validate_xmit_skb;
> + sk_validate = READ_ONCE(sk->sk_validate_xmit_skb);
> else if (sk_is_inet(sk) && sk->sk_state == TCP_TIME_WAIT)
> sk_validate = inet_twsk(sk)->tw_validate_xmit_skb;
> }
>
> if (sk_validate) {
> - skb = sk_validate(sk, dev, skb);
> + /* the socket's validator would apply instead of checking the
> + * association. A METADATA_PSP dst isn't given to the packets
> + * of a socket with its own offload, but the socket can gain
> + * one while such a packet is queued.
> + */
> + if (psp_md_needed_on() && skb_psp_md(skb)) {
> + kfree_skb_reason(skb, SKB_DROP_REASON_PSP_OUTPUT);
> + skb = NULL;
> + } else {
> + skb = sk_validate(sk, dev, skb);
> + }
> + } else if (psp_md_needed_on() && skb_psp_md(skb)) {
> + int psp = psp_xmit_md(skb, dev);
> +
> + if (psp <= 0) {
> + kfree_skb_reason(skb, psp == -EMSGSIZE ?
> + SKB_DROP_REASON_PKT_TOO_BIG :
> + SKB_DROP_REASON_PSP_OUTPUT);
> + skb = NULL;
> + }
[Severity: Medium]
Can a packet carrying a METADATA_PSP dst bypass sk_validate_xmit_skb() if
it is requeued onto q->gso_skb after initial validation?
When sch_direct_xmit() validates an skb via validate_xmit_skb_list() and
then finds the TX queue stopped or busy, dev_requeue_skb() parks the skb
on q->gso_skb. When dequeue_skb() later pops it from q->gso_skb, it
skips re-validation unless xfrm_offload(skb) is set:
net/sched/sch_generic.c:dequeue_skb() {
...
/* skb in gso_skb were already validated */
*validate = false;
if (xfrm_offload(skb))
*validate = true;
...
}
If psp_dev_unregister() runs while the skb is parked in q->gso_skb (or
skb->sk gains its own encryption offload), the subsequent
sch_direct_xmit() call skips validate_xmit_skb_list() and hands the skb
directly to ndo_start_xmit(), where the driver (such as
mlx5e_psp_set_state()) retrieves pas via psp_skb_get_assoc_rcu() and reads
a destroyed hardware encryption key ID from pas->drv_data.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124221758.3230929-1-toddfreed@meta.com?part=5
next prev parent reply other threads:[~2026-11-25 22:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 22:17 [PATCH net-next v3 00/12] psp: introduce socket-less associations Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 01/12] psp: get netns from net_device instead of sock Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 02/12] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 03/12] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 04/12] psp: add support for socket-less psp associations Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-25 22:19 ` sashiko-bot [this message]
2026-11-24 22:17 ` [PATCH net-next v3 06/12] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-25 22:19 ` sashiko-bot
2026-11-24 22:17 ` [PATCH net-next v3 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 08/12] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 09/12] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 11/12] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 12/12] Documentation: networking: psp: document socket-less associations Todd Freed
2026-11-25 22:19 ` [PATCH net-next v3 00/12] psp: introduce " sashiko-bot
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-234240@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=toddfreed@meta.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