Re: [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a psp association on an skb

From: netdev-bot+sashiko

Date: Sat Nov 28 2026 - 18:57:08 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Concern: in this commit nothing sets skb->decrypted on socket-
less METADATA_PSP packets, and the psp_md_alloc() kerneldoc does not…

--

net: add METADATA_PSP dst to carry a psp association on an skb

This commit adds a METADATA_PSP metadata_dst type that holds a reference
on a PSP association, so that an association can be attached to an skb
without a socket. psp_skb_get_assoc_rcu() now checks for it first.
__dev_queue_xmit() and sk_validate_xmit_skb() drop such packets if they
are on the wrong device or too big for the MTU.

> diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
> index 8f669304a9969..7c5291d5e9712 100644
> --- a/net/psp/psp_main.c
> +++ b/net/psp/psp_main.c
> @@ -217,6 +217,37 @@ unsigned int psp_key_size(u32 version)

[ ... ]

> +/**
> + * psp_md_alloc() - allocate a METADATA_PSP dst for an association
> + * @pas: association, the dst takes over the caller's reference on success
> + *
> + * Context: process context, may sleep.
> + * Return: the dst, or NULL on failure.
> + */
> +struct metadata_dst *psp_md_alloc(struct psp_assoc *pas)

[Severity: Low]
Should this kerneldoc say that whoever attaches the dst must also set
skb->decrypted?

In this commit nothing sets skb->decrypted on socket-less METADATA_PSP
packets. psp_skb_get_assoc_rcu() also returns the md association without
checking skb->decrypted.

Suppose the METADATA_PSP dst is lost after it is attached, for example
because a later action replaces the dst. sk_validate_xmit_skb() would then
skip the skb_psp_md() branch. It would also skip the fail-closed branch,
because that branch only runs when skb->decrypted is set:

} else if (unlikely(skb_is_decrypted(skb))) {
pr_warn_ratelimited("unencrypted skb with no associated socket - dropping\n");

In that case the packet would go out in clear text.

As far as I can tell, this is handled later in the series. In
"net/sched: add act_psp for psp transport mode", the encap path of
tcf_psp_act() does:

skb_dst_set(skb, dst_clone(&params->md->dst));
...
skb->decrypted = 1;

That is currently the only caller of psp_md_alloc(). INET_PSP selects
SKB_DECRYPTED and SOCK_VALIDATE_XMIT, so the drop path is always built in.

Given that, there is no runtime effect. Could the psp_md_alloc() kerneldoc
state the skb->decrypted rule, so that future callers keep this
fail-closed behaviour?

> +{
> + struct metadata_dst *md;
> +
> + if (!static_branch_inc(&psp_md_needed.key))
> + return NULL;
> + md = metadata_dst_alloc(0, METADATA_PSP, GFP_KERNEL);

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124221758.3230929-1-toddfreed%40meta.com