Skip to content

Commit a535d59

Browse files
kuba-mooPaolo Abeni
authored andcommitted
net: tls: fix marking packets as decrypted
For TLS offload we mark packets with skb->decrypted to make sure they don't escape the host without getting encrypted first. The crypto state lives in the socket, so it may get detached by a call to skb_orphan(). As a safety check - the egress path drops all packets with skb->decrypted and no "crypto-safe" socket. The skb marking was added to sendpage only (and not sendmsg), because tls_device injected data into the TCP stack using sendpage. This special case was missed when sendpage got folded into sendmsg. Fixes: c5c37af ("tcp: Convert do_tcp_sendpages() to use MSG_SPLICE_PAGES") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20240530232607.82686-1-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent d630180 commit a535d59

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/ipv4/tcp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,9 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
11651165

11661166
process_backlog++;
11671167

1168+
#ifdef CONFIG_SKB_DECRYPTED
1169+
skb->decrypted = !!(flags & MSG_SENDPAGE_DECRYPTED);
1170+
#endif
11681171
tcp_skb_entail(sk, skb);
11691172
copy = size_goal;
11701173

0 commit comments

Comments
 (0)