diff mbox series

[net-next,v7,1/2] tls: receive msg again for sk_redirect

Message ID ce31a803e39c856f27f16f9ec03376ef7fc4da81.1718182183.git.tanggeliang@kylinos.cn (mailing list archive)
State New
Headers show
Series Add F_SETFL for fcntl in test_sockmap | expand

Commit Message

Geliang Tang June 12, 2024, 9:19 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

tls_sw doesn't work for sk_redirect in nonblock mode, sk_msg_recvmsg()
returns 0 in that case in tls_sw_recvmsg(). This patch fixes this by using
"continue" to receive msg again instead of ending it if strp isn't ready
and rx_list is empty.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/tls/tls_sw.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jakub Kicinski June 12, 2024, 11:40 p.m. UTC | #1
On Wed, 12 Jun 2024 17:19:03 +0800 Geliang Tang wrote:
> tls_sw doesn't work for sk_redirect in nonblock mode, sk_msg_recvmsg()
> returns 0 in that case in tls_sw_recvmsg(). This patch fixes this by using
> "continue" to receive msg again instead of ending it if strp isn't ready
> and rx_list is empty.

Can you explain what user-visible behavior problem you're trying to fix?
sk_msg_recvmsg() returns 0, but tls_sw_recvmsg() will return -EAGAIN as 
a whole, so everything seems in order.
diff mbox series

Patch

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 305a412785f5..ae8bbe7dc8ec 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2017,6 +2017,9 @@  int tls_sw_recvmsg(struct sock *sk,
 					len -= chunk;
 					continue;
 				}
+				if (!chunk && !tls_strp_msg_ready(ctx) &&
+				    skb_queue_empty_lockless(&ctx->rx_list))
+					continue;
 			}
 			goto recv_end;
 		}