Re: [PATCH net-next v1 08/15] psp: only give time-wait sockets of psp connections a validator

From
Daniel Zahka <daniel.zahka@gmail.com>
Date
2026-11-11 11:37:41
Also in
bpf, linux-doc, linux-kselftest, linux-rdma, lkml
Reply to
Todd Freed, 2026-11-11
On Tue Nov 10, 2026 at 7:55 PM EST, Todd Freed wrote:
psp_twsk_init() sets tw_validate_xmit_skb on tcp time-wait sockets.
today, that becomes set whether or not the socket has psp offload, which
is not needed but is harmless. psp_validate_xmit() passes such packets.
This can get sent as a standalone patch. I would probably tag it as a
fix too, even though it is benign. I can't remember why we (I) didn't
put the validation hook under the branch, but looking at it now, it just
looks like a bug.
quoted hunk ↗ jump to hunk
but a validator makes a socket look like it has an encryption offload of
its own, and the tc psp action, added in the next patch, relies on that:
encap refuses the packets of such a socket, and sk_validate_xmit_skb()
drops a packet with a psp association whose socket has a validator.

set the validator only when the socket has a psp association.

Signed-off-by: Todd Freed <redacted>
---
 net/psp/psp_sock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
index 609b06c7af65..664955bfb4fd 100644
--- a/net/psp/psp_sock.c
+++ b/net/psp/psp_sock.c
@@ -330,10 +330,14 @@ void psp_twsk_init(struct inet_timewait_sock *tw, const struct sock *sk)
 {
 	struct psp_assoc *pas = psp_sk_assoc(sk);
 
-	if (pas)
+	if (pas) {
 		refcount_inc(&pas->refcnt);
+		/* Only for PSP connections: a validator makes the socket
+		 * look like it has an encryption offload of its own
+		 */
comment nit: for my taste, having a comment that starts with "Only for
PSP connections:" two lines under an if (pas) branch feels unnecessary.
quoted hunk ↗ jump to hunk
+		tw->tw_validate_xmit_skb = psp_validate_xmit;
+	}
 	rcu_assign_pointer(tw->psp_assoc, pas);
-	tw->tw_validate_xmit_skb = psp_validate_xmit;
 }
 
 void psp_twsk_assoc_free(struct inet_timewait_sock *tw)
  
Thread (38 messages) 38 messages, 4 authors, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help