* [PATCH net 0/1] tls: device: push pending open record on splice EOF
@ 2026-07-09 22:44 Rishikesh Jethwani
2026-07-09 22:44 ` [PATCH 1/1] " Rishikesh Jethwani
2026-07-21 22:00 ` [PATCH net 0/1] " patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Rishikesh Jethwani @ 2026-07-09 22:44 UTC (permalink / raw)
To: netdev
Cc: john.fastabend, kuba, sd, davem, pabeni, edumazet, leon,
nils.juenemann, Rishikesh Jethwani
Hi all,
A kTLS socket with device (HW) TX offload can leave its final
record unsent when sendfile(2) is called with count > bytes-
remaining in the file and the connection is closed without a
trailing write. fs/splice.c fires ->splice_eof on the socket in
this case, and tls_device_splice_eof() pre-patch only pushed
partially-sent records - a fully-assembled but still-open record
stayed pending until the next write, which an abrupt close()
never provides. TLS_SW is unaffected; tls_sw_splice_eof() already
handles pending open records.
Report and discussion:
https://lore.kernel.org/netdev/CAMPsyauZ+jzG9AysO0FWv6ZY0kvCUpjX_U7o=oOjCuOQ87BCgg@mail.gmail.com/
Rishikesh
Rishikesh Jethwani (1):
tls: device: push pending open record on splice EOF
net/tls/tls_device.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] tls: device: push pending open record on splice EOF
2026-07-09 22:44 [PATCH net 0/1] tls: device: push pending open record on splice EOF Rishikesh Jethwani
@ 2026-07-09 22:44 ` Rishikesh Jethwani
2026-07-13 20:29 ` Nils Juenemann
2026-07-21 22:00 ` [PATCH net 0/1] " patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Rishikesh Jethwani @ 2026-07-09 22:44 UTC (permalink / raw)
To: netdev
Cc: john.fastabend, kuba, sd, davem, pabeni, edumazet, leon,
nils.juenemann, Rishikesh Jethwani
On kTLS device-offload sockets, sendfile() with count > EOF can reach
->splice_eof() with a fully assembled but still-open TLS record left
pending. tls_device_splice_eof() only flushes partially sent records,
so an abrupt close() can drop the final record and the peer receives
a short file.
Fix tls_device_splice_eof() to also push pending open records.
This matches the software path, where splice EOF already flushes
pending open records.
Fixes: d4c1e80b0d1b ("tls/device: Use splice_eof() to flush")
Link: https://lore.kernel.org/netdev/CAMPsyauZ+jzG9AysO0FWv6ZY0kvCUpjX_U7o=oOjCuOQ87BCgg@mail.gmail.com/
Reported-by: Nils Juenemann <nils.juenemann@gmail.com>
Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
net/tls/tls_device.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index 741aef09bfd3..37bb06a8e8f5 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -595,13 +595,15 @@ void tls_device_splice_eof(struct socket *sock)
struct tls_context *tls_ctx = tls_get_ctx(sk);
struct iov_iter iter = {};
- if (!tls_is_partially_sent_record(tls_ctx))
+ if (!tls_is_partially_sent_record(tls_ctx) &&
+ !tls_is_pending_open_record(tls_ctx))
return;
mutex_lock(&tls_ctx->tx_lock);
lock_sock(sk);
- if (tls_is_partially_sent_record(tls_ctx)) {
+ if (tls_is_partially_sent_record(tls_ctx) ||
+ tls_is_pending_open_record(tls_ctx)) {
iov_iter_bvec(&iter, ITER_SOURCE, NULL, 0, 0);
tls_push_data(sk, &iter, 0, 0, TLS_RECORD_TYPE_DATA);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] tls: device: push pending open record on splice EOF
2026-07-09 22:44 ` [PATCH 1/1] " Rishikesh Jethwani
@ 2026-07-13 20:29 ` Nils Juenemann
0 siblings, 0 replies; 4+ messages in thread
From: Nils Juenemann @ 2026-07-13 20:29 UTC (permalink / raw)
To: rjethwani
Cc: netdev, john.fastabend, kuba, sd, davem, pabeni, edumazet, leon,
nils.juenemann
On Thu, Jul 9, 2026 at 4:44 PM Rishikesh Jethwani <rjethwani@purestorage.com> wrote:
>
> On kTLS device-offload sockets, sendfile() with count > EOF can reach
> ->splice_eof() with a fully assembled but still-open TLS record left
> pending.
[...]
Confirmed on ConnectX-6 Dx with TLS 1.3 device offload: with this fix,
the sendfile() count > EOF + abrupt close() case no longer drops the
final record.
Tested-by: Nils Juenemann <nils.juenemann@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/1] tls: device: push pending open record on splice EOF
2026-07-09 22:44 [PATCH net 0/1] tls: device: push pending open record on splice EOF Rishikesh Jethwani
2026-07-09 22:44 ` [PATCH 1/1] " Rishikesh Jethwani
@ 2026-07-21 22:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-21 22:00 UTC (permalink / raw)
To: Rishikesh Jethwani
Cc: netdev, john.fastabend, kuba, sd, davem, pabeni, edumazet, leon,
nils.juenemann
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 9 Jul 2026 16:44:35 -0600 you wrote:
> Hi all,
>
> A kTLS socket with device (HW) TX offload can leave its final
> record unsent when sendfile(2) is called with count > bytes-
> remaining in the file and the connection is closed without a
> trailing write. fs/splice.c fires ->splice_eof on the socket in
> this case, and tls_device_splice_eof() pre-patch only pushed
> partially-sent records - a fully-assembled but still-open record
> stayed pending until the next write, which an abrupt close()
> never provides. TLS_SW is unaffected; tls_sw_splice_eof() already
> handles pending open records.
>
> [...]
Here is the summary with links:
- [1/1] tls: device: push pending open record on splice EOF
https://git.kernel.org/netdev/net/c/eaa39f9f8ac8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-21 22:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 22:44 [PATCH net 0/1] tls: device: push pending open record on splice EOF Rishikesh Jethwani
2026-07-09 22:44 ` [PATCH 1/1] " Rishikesh Jethwani
2026-07-13 20:29 ` Nils Juenemann
2026-07-21 22:00 ` [PATCH net 0/1] " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox