[PATCH net] tls: skip empty data records in tls_sw_splice_read()
From: Qingfang Deng
Date: Wed Sep 30 2026 - 01:27:03 EST
tls_sw_splice_read() returns 0 after receiving an empty application
record. This looks like EOF for splice(), even though the connection
remains open and more data may be available.
Consume empty application records and retry the receive path instead,
following the approach used in tls_sw_read_sock() since commit
3be28e2c9cd0 ("net/tls: Consume empty data records in tls_sw_read_sock()").
Fixes: c46234ebb4d1 ("tls: RX path for ktls")
Reported-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/netdev/akaoXcfamBp8_mYe@krikkit/
Signed-off-by: Qingfang Deng <qingfang.deng@xxxxxxxxx>
---
net/tls/tls_sw.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index d1ad31986cf2..e23bb8a9dedd 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2019,6 +2019,7 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
if (err)
goto splice_read_end;
+retry:
if (!skb_queue_empty(&ctx->rx_list)) {
skb = __skb_dequeue(&ctx->rx_list);
} else {
@@ -2048,6 +2049,12 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
goto splice_requeue;
}
+ /* Empty application records must not be reported as EOF. */
+ if (!rxm->full_len) {
+ consume_skb(skb);
+ goto retry;
+ }
+
chunk = min_t(unsigned int, rxm->full_len, len);
copied = skb_splice_bits(skb, sk, rxm->offset, pipe, chunk, flags);
if (copied < 0)
--
2.43.0