net: tls: fix marking packets as decrypted
authorJakub Kicinski <kuba@kernel.org>
Thu, 30 May 2024 23:26:07 +0000 (16:26 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 4 Jun 2024 10:58:50 +0000 (12:58 +0200)
commita535d59432370343058755100ee75ab03c0e3f91
treee4e1313b4888a18395e016d272f784aceccf30f3
parentd6301802607bc036823fb47abaa2cf92fb74db91
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: c5c37af6ecad ("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>
net/ipv4/tcp.c