diff mbox series

[SRU,D,3/3] net/tls: fix poll ignoring partially copied records

Message ID 20200722193402.358366-4-cascardo@canonical.com
State New
Headers show
Series [SRU,D,1/3] net/tls: fix lowat calculation if some data came from previous record | expand

Commit Message

Thadeu Lima de Souza Cascardo July 22, 2020, 7:34 p.m. UTC
From: Jakub Kicinski <jakub.kicinski@netronome.com>

BugLink: https://bugs.launchpad.net/bugs/1888381

David reports that RPC applications which use epoll() occasionally
get stuck, and that TLS ULP causes the kernel to not wake applications,
even though read() will return data.

This is indeed true. The ctx->rx_list which holds partially copied
records is not consulted when deciding whether socket is readable.

Note that SO_RCVLOWAT with epoll() is and has always been broken for
kernel TLS. We'd need to parse all records from the TCP layer, instead
of just the first one.

Fixes: 692d7b5d1f91 ("tls: Fix recvmsg() to be able to peek across multiple records")
Reported-by: David Beckett <david.beckett@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 13aecb17acabc2a92187d08f7ca93bb8aad62c6f)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 net/tls/tls_sw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 74513bcb3824..72e21915ddfa 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1830,7 +1830,8 @@  bool tls_sw_stream_read(const struct sock *sk)
 		ingress_empty = list_empty(&psock->ingress_msg);
 	rcu_read_unlock();
 
-	return !ingress_empty || ctx->recv_pkt;
+	return !ingress_empty || ctx->recv_pkt ||
+		!skb_queue_empty(&ctx->rx_list);
 }
 
 static int tls_read_size(struct strparser *strp, struct sk_buff *skb)