Once tls_sw_recvmsg() has copied enough data to meet the receive low-water mark, the receive loop continues only while another record is ready. A zero-length application_data record is consumed without advancing len, so a peer that follows data with a stream of empty records keeps the reader in the loop. The reader does not get the data already copied until the stream stops or a signal is pending. The delay has not been reproduced. Leave the receive loop at an empty record once the low-water mark is met. A reader that has copied nothing still reads empty records for as long as they arrive. Fixes: 04b25a5411f9 ("net/tls: fix no wakeup on partial reads") Suggested-by: sashiko-bot Link: https://lore.kernel.org/r/179124254665.434549.12245680127262431659@kernel.org Signed-off-by: Chuck Lever --- net/tls/tls_sw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index b7790b17f79c..15a3a6d3f638 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1939,6 +1939,12 @@ int tls_sw_recvmsg(struct sock *sk, /* An empty record still marks a boundary. */ msg->msg_flags |= MSG_EOR; + + /* Return data already copied instead of holding it + * through a run of empty records. + */ + if (decrypted + copied >= target) + break; continue; } -- 2.55.0