All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] tcp: restore fastopen with no data in SYN packet
@ 2015-12-16 21:53 Eric Dumazet
  2015-12-16 23:02 ` Yuchung Cheng
  2015-12-17 20:38 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2015-12-16 21:53 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Yuchung Cheng, Al Viro

From: Eric Dumazet <edumazet@google.com>

Yuchung tracked a regression caused by commit 57be5bdad759 ("ip: convert
tcp_sendmsg() to iov_iter primitives") for TCP Fast Open.

Some Fast Open users do not actually add any data in the SYN packet.

Fixes: 57be5bdad759 ("ip: convert tcp_sendmsg() to iov_iter primitives")
Reported-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
 net/ipv4/tcp_output.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index cb7ca569052c..9bfc39ff2285 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3150,7 +3150,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct tcp_fastopen_request *fo = tp->fastopen_req;
-	int syn_loss = 0, space, err = 0, copied;
+	int syn_loss = 0, space, err = 0;
 	unsigned long last_syn_loss = 0;
 	struct sk_buff *syn_data;
 
@@ -3188,17 +3188,18 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
 		goto fallback;
 	syn_data->ip_summed = CHECKSUM_PARTIAL;
 	memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
-	copied = copy_from_iter(skb_put(syn_data, space), space,
-				&fo->data->msg_iter);
-	if (unlikely(!copied)) {
-		kfree_skb(syn_data);
-		goto fallback;
-	}
-	if (copied != space) {
-		skb_trim(syn_data, copied);
-		space = copied;
+	if (space) {
+		int copied = copy_from_iter(skb_put(syn_data, space), space,
+					    &fo->data->msg_iter);
+		if (unlikely(!copied)) {
+			kfree_skb(syn_data);
+			goto fallback;
+		}
+		if (copied != space) {
+			skb_trim(syn_data, copied);
+			space = copied;
+		}
 	}
-
 	/* No more data pending in inet_wait_for_connect() */
 	if (space == fo->size)
 		fo->data = NULL;

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

* Re: [PATCH net] tcp: restore fastopen with no data in SYN packet
  2015-12-16 21:53 [PATCH net] tcp: restore fastopen with no data in SYN packet Eric Dumazet
@ 2015-12-16 23:02 ` Yuchung Cheng
  2015-12-17 20:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Yuchung Cheng @ 2015-12-16 23:02 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Al Viro

On Wed, Dec 16, 2015 at 1:53 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> From: Eric Dumazet <edumazet@google.com>
>
> Yuchung tracked a regression caused by commit 57be5bdad759 ("ip: convert
> tcp_sendmsg() to iov_iter primitives") for TCP Fast Open.
>
> Some Fast Open users do not actually add any data in the SYN packet.
>
> Fixes: 57be5bdad759 ("ip: convert tcp_sendmsg() to iov_iter primitives")
> Reported-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> ---
Acked-by: Yuchung Cheng <ycheng@google.com>
>  net/ipv4/tcp_output.c |   23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index cb7ca569052c..9bfc39ff2285 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -3150,7 +3150,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
>  {
>         struct tcp_sock *tp = tcp_sk(sk);
>         struct tcp_fastopen_request *fo = tp->fastopen_req;
> -       int syn_loss = 0, space, err = 0, copied;
> +       int syn_loss = 0, space, err = 0;
>         unsigned long last_syn_loss = 0;
>         struct sk_buff *syn_data;
>
> @@ -3188,17 +3188,18 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)
>                 goto fallback;
>         syn_data->ip_summed = CHECKSUM_PARTIAL;
>         memcpy(syn_data->cb, syn->cb, sizeof(syn->cb));
> -       copied = copy_from_iter(skb_put(syn_data, space), space,
> -                               &fo->data->msg_iter);
> -       if (unlikely(!copied)) {
> -               kfree_skb(syn_data);
> -               goto fallback;
> -       }
> -       if (copied != space) {
> -               skb_trim(syn_data, copied);
> -               space = copied;
> +       if (space) {
> +               int copied = copy_from_iter(skb_put(syn_data, space), space,
> +                                           &fo->data->msg_iter);
> +               if (unlikely(!copied)) {
> +                       kfree_skb(syn_data);
> +                       goto fallback;
> +               }
> +               if (copied != space) {
> +                       skb_trim(syn_data, copied);
> +                       space = copied;
> +               }
>         }
> -
>         /* No more data pending in inet_wait_for_connect() */
>         if (space == fo->size)
>                 fo->data = NULL;
>
>

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

* Re: [PATCH net] tcp: restore fastopen with no data in SYN packet
  2015-12-16 21:53 [PATCH net] tcp: restore fastopen with no data in SYN packet Eric Dumazet
  2015-12-16 23:02 ` Yuchung Cheng
@ 2015-12-17 20:38 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-12-17 20:38 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, ycheng, viro

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 16 Dec 2015 13:53:10 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> Yuchung tracked a regression caused by commit 57be5bdad759 ("ip: convert
> tcp_sendmsg() to iov_iter primitives") for TCP Fast Open.
> 
> Some Fast Open users do not actually add any data in the SYN packet.
> 
> Fixes: 57be5bdad759 ("ip: convert tcp_sendmsg() to iov_iter primitives")
> Reported-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied and queued up for -stable, thanks Eric.

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

end of thread, other threads:[~2015-12-17 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-16 21:53 [PATCH net] tcp: restore fastopen with no data in SYN packet Eric Dumazet
2015-12-16 23:02 ` Yuchung Cheng
2015-12-17 20:38 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.