Skip to content

Commit 4514f01

Browse files
Rishikesh Jethwanigregkh
authored andcommitted
tls: device: push pending open record on splice EOF
[ Upstream commit eaa39f9 ] 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: d4c1e80 ("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> Tested-by: Nils Juenemann <nils.juenemann@gmail.com> Link: https://patch.msgid.link/20260709224436.1608993-2-rjethwani@purestorage.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 49d15cf commit 4514f01

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

net/tls/tls_device.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,13 +594,15 @@ void tls_device_splice_eof(struct socket *sock)
594594
struct tls_context *tls_ctx = tls_get_ctx(sk);
595595
struct iov_iter iter = {};
596596

597-
if (!tls_is_partially_sent_record(tls_ctx))
597+
if (!tls_is_partially_sent_record(tls_ctx) &&
598+
!tls_is_pending_open_record(tls_ctx))
598599
return;
599600

600601
mutex_lock(&tls_ctx->tx_lock);
601602
lock_sock(sk);
602603

603-
if (tls_is_partially_sent_record(tls_ctx)) {
604+
if (tls_is_partially_sent_record(tls_ctx) ||
605+
tls_is_pending_open_record(tls_ctx)) {
604606
iov_iter_bvec(&iter, ITER_SOURCE, NULL, 0, 0);
605607
tls_push_data(sk, &iter, 0, 0, TLS_RECORD_TYPE_DATA);
606608
}

0 commit comments

Comments
 (0)