netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc
@ 2016-09-07 15:34 Eric Dumazet
  2016-09-07 19:48 ` Josh Hunt
  2016-09-08 23:08 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-09-07 15:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Josh Hunt, Jerry Chu, Yuchung Cheng, Neal Cardwell

From: Eric Dumazet <edumazet@google.com>

When DATA and/or FIN are carried in a SYN/ACK message or SYN message,
we append an skb in socket receive queue, but we forget to call
sk_forced_mem_schedule().

Effect is that the socket has a negative sk->sk_forward_alloc as long as
the message is not read by the application.

Josh Hunt fixed a similar issue in commit d22e15371811 ("tcp: fix tcp
fin memory accounting")
 
Fixes: 168a8f58059a ("tcp: TCP Fast Open Server - main code path")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_fastopen.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 62a5751d4fe1..4e777a3243f9 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -150,6 +150,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb)
 	tp->segs_in = 0;
 	tcp_segs_in(tp, skb);
 	__skb_pull(skb, tcp_hdrlen(skb));
+	sk_forced_mem_schedule(sk, skb->truesize);
 	skb_set_owner_r(skb, sk);
 
 	TCP_SKB_CB(skb)->seq++;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc
  2016-09-07 15:34 [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc Eric Dumazet
@ 2016-09-07 19:48 ` Josh Hunt
  2016-09-08 23:08 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Josh Hunt @ 2016-09-07 19:48 UTC (permalink / raw)
  To: Eric Dumazet, David Miller
  Cc: netdev, Jerry Chu, Yuchung Cheng, Neal Cardwell

On 09/07/2016 10:34 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> When DATA and/or FIN are carried in a SYN/ACK message or SYN message,
> we append an skb in socket receive queue, but we forget to call
> sk_forced_mem_schedule().
>
> Effect is that the socket has a negative sk->sk_forward_alloc as long as
> the message is not read by the application.
>
> Josh Hunt fixed a similar issue in commit d22e15371811 ("tcp: fix tcp
> fin memory accounting")
>
> Fixes: 168a8f58059a ("tcp: TCP Fast Open Server - main code path")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   net/ipv4/tcp_fastopen.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> index 62a5751d4fe1..4e777a3243f9 100644
> --- a/net/ipv4/tcp_fastopen.c
> +++ b/net/ipv4/tcp_fastopen.c
> @@ -150,6 +150,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb)
>   	tp->segs_in = 0;
>   	tcp_segs_in(tp, skb);
>   	__skb_pull(skb, tcp_hdrlen(skb));
> +	sk_forced_mem_schedule(sk, skb->truesize);
>   	skb_set_owner_r(skb, sk);
>
>   	TCP_SKB_CB(skb)->seq++;
>
>

The change makes sense to me. Thanks Eric!

Reviewed-by: Josh Hunt <johunt@akamai.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc
  2016-09-07 15:34 [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc Eric Dumazet
  2016-09-07 19:48 ` Josh Hunt
@ 2016-09-08 23:08 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-09-08 23:08 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, johunt, hkchu, ycheng, ncardwell

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 07 Sep 2016 08:34:11 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> When DATA and/or FIN are carried in a SYN/ACK message or SYN message,
> we append an skb in socket receive queue, but we forget to call
> sk_forced_mem_schedule().
> 
> Effect is that the socket has a negative sk->sk_forward_alloc as long as
> the message is not read by the application.
> 
> Josh Hunt fixed a similar issue in commit d22e15371811 ("tcp: fix tcp
> fin memory accounting")
>  
> Fixes: 168a8f58059a ("tcp: TCP Fast Open Server - main code path")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-08 23:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-07 15:34 [PATCH net] tcp: fastopen: avoid negative sk_forward_alloc Eric Dumazet
2016-09-07 19:48 ` Josh Hunt
2016-09-08 23:08 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).