diff mbox series

tcp/dccp: allow a connection when sk_max_ack_backlog is zero

Message ID 20250102171426.915276-1-dzq.aishenghu0@gmail.com (mailing list archive)
State Accepted
Commit 3479c7549fb1dfa7a1db4efb7347c7b8ef50de4b
Delegated to: Netdev Maintainers
Headers show
Series tcp/dccp: allow a connection when sk_max_ack_backlog is zero | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be 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: 14 this patch: 14
netdev/build_tools success Errors and warnings before: 0 (+23) this patch: 0 (+23)
netdev/cc_maintainers warning 1 maintainers not CCed: horms@kernel.org
netdev/build_clang success Errors and warnings before: 2712 this patch: 2712
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 2057 this patch: 2057
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 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 success net-next-2025-01-04--00-00 (tests: 885)

Commit Message

Zhongqiu Duan Jan. 2, 2025, 5:14 p.m. UTC
If the backlog of listen() is set to zero, sk_acceptq_is_full() allows
one connection to be made, but inet_csk_reqsk_queue_is_full() does not.
When the net.ipv4.tcp_syncookies is zero, inet_csk_reqsk_queue_is_full()
will cause an immediate drop before the sk_acceptq_is_full() check in
tcp_conn_request(), resulting in no connection can be made.

This patch tries to keep consistent with 64a146513f8f ("[NET]: Revert
incorrect accept queue backlog changes.").

Link: https://lore.kernel.org/netdev/20250102080258.53858-1-kuniyu@amazon.com/
Fixes: ef547f2ac16b ("tcp: remove max_qlen_log")
Signed-off-by: Zhongqiu Duan <dzq.aishenghu0@gmail.com>
---
 include/net/inet_connection_sock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kuniyuki Iwashima Jan. 3, 2025, 2:52 p.m. UTC | #1
From: Zhongqiu Duan <dzq.aishenghu0@gmail.com>
Date: Thu,  2 Jan 2025 17:14:26 +0000
> If the backlog of listen() is set to zero, sk_acceptq_is_full() allows
> one connection to be made, but inet_csk_reqsk_queue_is_full() does not.
> When the net.ipv4.tcp_syncookies is zero, inet_csk_reqsk_queue_is_full()
> will cause an immediate drop before the sk_acceptq_is_full() check in
> tcp_conn_request(), resulting in no connection can be made.
> 
> This patch tries to keep consistent with 64a146513f8f ("[NET]: Revert
> incorrect accept queue backlog changes.").
> 
> Link: https://lore.kernel.org/netdev/20250102080258.53858-1-kuniyu@amazon.com/
> Fixes: ef547f2ac16b ("tcp: remove max_qlen_log")
> Signed-off-by: Zhongqiu Duan <dzq.aishenghu0@gmail.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>


> ---
>  include/net/inet_connection_sock.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
> index 3c82fad904d4..c7f42844c79a 100644
> --- a/include/net/inet_connection_sock.h
> +++ b/include/net/inet_connection_sock.h
> @@ -282,7 +282,7 @@ static inline int inet_csk_reqsk_queue_len(const struct sock *sk)
>  
>  static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
>  {
> -	return inet_csk_reqsk_queue_len(sk) >= READ_ONCE(sk->sk_max_ack_backlog);
> +	return inet_csk_reqsk_queue_len(sk) > READ_ONCE(sk->sk_max_ack_backlog);
>  }
>  
>  bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req);
> -- 
> 2.34.1
>
Jason Xing Jan. 4, 2025, 1:22 a.m. UTC | #2
On Fri, Jan 3, 2025 at 1:14 AM Zhongqiu Duan <dzq.aishenghu0@gmail.com> wrote:
>
> If the backlog of listen() is set to zero, sk_acceptq_is_full() allows
> one connection to be made, but inet_csk_reqsk_queue_is_full() does not.
> When the net.ipv4.tcp_syncookies is zero, inet_csk_reqsk_queue_is_full()
> will cause an immediate drop before the sk_acceptq_is_full() check in
> tcp_conn_request(), resulting in no connection can be made.
>
> This patch tries to keep consistent with 64a146513f8f ("[NET]: Revert
> incorrect accept queue backlog changes.").
>
> Link: https://lore.kernel.org/netdev/20250102080258.53858-1-kuniyu@amazon.com/
> Fixes: ef547f2ac16b ("tcp: remove max_qlen_log")
> Signed-off-by: Zhongqiu Duan <dzq.aishenghu0@gmail.com>

Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Eric Dumazet Jan. 4, 2025, 8:35 a.m. UTC | #3
On Sat, Jan 4, 2025 at 2:23 AM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> On Fri, Jan 3, 2025 at 1:14 AM Zhongqiu Duan <dzq.aishenghu0@gmail.com> wrote:
> >
> > If the backlog of listen() is set to zero, sk_acceptq_is_full() allows
> > one connection to be made, but inet_csk_reqsk_queue_is_full() does not.
> > When the net.ipv4.tcp_syncookies is zero, inet_csk_reqsk_queue_is_full()
> > will cause an immediate drop before the sk_acceptq_is_full() check in
> > tcp_conn_request(), resulting in no connection can be made.
> >
> > This patch tries to keep consistent with 64a146513f8f ("[NET]: Revert
> > incorrect accept queue backlog changes.").
> >
> > Link: https://lore.kernel.org/netdev/20250102080258.53858-1-kuniyu@amazon.com/
> > Fixes: ef547f2ac16b ("tcp: remove max_qlen_log")
> > Signed-off-by: Zhongqiu Duan <dzq.aishenghu0@gmail.com>
>
> Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>
patchwork-bot+netdevbpf@kernel.org Jan. 4, 2025, 5 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu,  2 Jan 2025 17:14:26 +0000 you wrote:
> If the backlog of listen() is set to zero, sk_acceptq_is_full() allows
> one connection to be made, but inet_csk_reqsk_queue_is_full() does not.
> When the net.ipv4.tcp_syncookies is zero, inet_csk_reqsk_queue_is_full()
> will cause an immediate drop before the sk_acceptq_is_full() check in
> tcp_conn_request(), resulting in no connection can be made.
> 
> This patch tries to keep consistent with 64a146513f8f ("[NET]: Revert
> incorrect accept queue backlog changes.").
> 
> [...]

Here is the summary with links:
  - tcp/dccp: allow a connection when sk_max_ack_backlog is zero
    https://git.kernel.org/netdev/net/c/3479c7549fb1

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 3c82fad904d4..c7f42844c79a 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -282,7 +282,7 @@  static inline int inet_csk_reqsk_queue_len(const struct sock *sk)
 
 static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk)
 {
-	return inet_csk_reqsk_queue_len(sk) >= READ_ONCE(sk->sk_max_ack_backlog);
+	return inet_csk_reqsk_queue_len(sk) > READ_ONCE(sk->sk_max_ack_backlog);
 }
 
 bool inet_csk_reqsk_queue_drop(struct sock *sk, struct request_sock *req);