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 Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add F_SETFL for fcntl in test_sockmap | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 850 this patch: 850
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 854 this patch: 854
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 854 this patch: 854
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-06-12--21-00 (tests: 648)

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;
 		}