# \[PATCH AUTOSEL 5.11 10/38\] net: correct sk\_acceptq\_is\_full()

- Subsystems: NETWORKING \[GENERAL\], NETWORKING \[SOCKETS\], THE REST
- Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Kuniyuki Iwashima, Linus Torvalds
- List: netdev
- 3 messages, 2 authors
- Page: https://ratatoskr.run/netdev/2021/03/6320254/t

## \[PATCH AUTOSEL 5.11 10/38\] net: correct sk\_acceptq\_is\_full()

- From: Sasha Levin \<sashal@kernel.org\>
- Date: 2021-03-29 22:22:59 
- Message: https://ratatoskr.run/netdev/2021/03/6320254.md

```text
From: liuyacan <redacted>

[ Upstream commit f211ac154577ec9ccf07c15f18a6abf0d9bdb4ab ]

The "backlog" argument in listen() specifies
the maximom length of pending connections,
so the accept queue should be considered full
if there are exactly "backlog" elements.

Signed-off-by: liuyacan <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/net/sock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 129d200bccb4..a95f38a4b8c6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -936,7 +936,7 @@ static inline void sk_acceptq_added(struct sock *sk)
 
 static inline bool sk_acceptq_is_full(const struct sock *sk)
 {
-	return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog);
+	return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog);
 }
 
 /*
-- 
2.30.1

```

## Re: \[PATCH AUTOSEL 5.11 10/38\] net: correct sk\_acceptq\_is\_full()

- From: Eric Dumazet \<hidden\>
- Date: 2021-03-31 16:18:14 
- Message: https://ratatoskr.run/netdev/2021/03/6322917.md

```text


On 3/30/21 12:21 AM, Sasha Levin wrote:
> From: liuyacan <redacted>
> 
> [ Upstream commit f211ac154577ec9ccf07c15f18a6abf0d9bdb4ab ]
> 
> The "backlog" argument in listen() specifies
> the maximom length of pending connections,
> so the accept queue should be considered full
> if there are exactly "backlog" elements.
> 
> Signed-off-by: liuyacan <redacted>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  include/net/sock.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 129d200bccb4..a95f38a4b8c6 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -936,7 +936,7 @@ static inline void sk_acceptq_added(struct sock *sk)
>  
>  static inline bool sk_acceptq_is_full(const struct sock *sk)
>  {
> -	return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog);
> +	return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog);
>  }
>  
>  /*
> 


????

I have not seen this patch going in our trees.

First, there was no Fixes: tag, so this is quite unfortunate.

Second, we already had such wrong patches in the past.

Please look at commits
64a146513f8f12ba204b7bf5cb7e9505594ead42 [NET]: Revert incorrect accept queue backlog changes.
8488df894d05d6fa41c2bd298c335f944bb0e401 [NET]: Fix bugs in "Whether sock accept queue is full" checking

Please revert  this patch, thanks !

```

## Re: \[PATCH AUTOSEL 5.11 10/38\] net: correct sk\_acceptq\_is\_full()

- From: Sasha Levin \<sashal@kernel.org\>
- Date: 2021-04-01 02:57:18 
- Message: https://ratatoskr.run/netdev/2021/04/6323395.md

```text
On Wed, Mar 31, 2021 at 06:17:27PM +0200, Eric Dumazet wrote:
>
>
>On 3/30/21 12:21 AM, Sasha Levin wrote:
>> From: liuyacan <redacted>
>>
>> [ Upstream commit f211ac154577ec9ccf07c15f18a6abf0d9bdb4ab ]
>>
>> The "backlog" argument in listen() specifies
>> the maximom length of pending connections,
>> so the accept queue should be considered full
>> if there are exactly "backlog" elements.
>>
>> Signed-off-by: liuyacan <redacted>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>> ---
>>  include/net/sock.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/net/sock.h b/include/net/sock.h
>> index 129d200bccb4..a95f38a4b8c6 100644
>> --- a/include/net/sock.h
>> +++ b/include/net/sock.h
>> @@ -936,7 +936,7 @@ static inline void sk_acceptq_added(struct sock *sk)
>>
>>  static inline bool sk_acceptq_is_full(const struct sock *sk)
>>  {
>> -	return READ_ONCE(sk->sk_ack_backlog) > READ_ONCE(sk->sk_max_ack_backlog);
>> +	return READ_ONCE(sk->sk_ack_backlog) >= READ_ONCE(sk->sk_max_ack_backlog);
>>  }
>>
>>  /*
>>
>
>
>????
>
>I have not seen this patch going in our trees.
>
>First, there was no Fixes: tag, so this is quite unfortunate.
>
>Second, we already had such wrong patches in the past.
>
>Please look at commits
>64a146513f8f12ba204b7bf5cb7e9505594ead42 [NET]: Revert incorrect accept queue backlog changes.
>8488df894d05d6fa41c2bd298c335f944bb0e401 [NET]: Fix bugs in "Whether sock accept queue is full" checking
>
>Please revert  this patch, thanks !

Dropped, thanks for letting me know!

-- 
Thanks,
Sasha
```
