All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
@ 2020-03-19 21:45 ` Davide Caratti
  0 siblings, 0 replies; 8+ messages in thread
From: Davide Caratti @ 2020-03-19 21:45 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 1982 bytes --]

it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
flags/version during the three-way handshake). Adjust MPTCP socket state
earlier, to ensure correct functionality of mptcp_sendmsg() even in case
of TCP fallback.

Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
 net/mptcp/protocol.c | 4 ----
 net/mptcp/subflow.c  | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e959104832ef..92d5382e71f4 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1055,10 +1055,6 @@ void mptcp_finish_connect(struct sock *ssk)
 	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
 	WRITE_ONCE(msk->ack_seq, ack_seq);
 	WRITE_ONCE(msk->can_ack, 1);
-	if (inet_sk_state_load(sk) != TCP_ESTABLISHED) {
-		inet_sk_state_store(sk, TCP_ESTABLISHED);
-		sk->sk_state_change(sk);
-	}
 }
 
 static void mptcp_sock_graft(struct sock *sk, struct socket *parent)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 052d72a1d3a2..06b9075333c5 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -109,9 +109,15 @@ static void subflow_v6_init_req(struct request_sock *req,
 static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
+	struct sock *parent = subflow->conn;
 
 	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
 
+	if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
+		inet_sk_state_store(parent, TCP_ESTABLISHED);
+		parent->sk_state_change(parent);
+	}
+
 	if (!subflow->conn_finished) {
 		pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
 			 subflow->remote_key);
-- 
2.24.1

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

* [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
@ 2020-03-19 21:45 ` Davide Caratti
  0 siblings, 0 replies; 8+ messages in thread
From: Davide Caratti @ 2020-03-19 21:45 UTC (permalink / raw)
  To: Mat Martineau, Matthieu Baerts, David S. Miller, Paolo Abeni,
	Jakub Kicinski
  Cc: netdev, mptcp

it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
flags/version during the three-way handshake). Adjust MPTCP socket state
earlier, to ensure correct functionality of mptcp_sendmsg() even in case
of TCP fallback.

Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
 net/mptcp/protocol.c | 4 ----
 net/mptcp/subflow.c  | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e959104832ef..92d5382e71f4 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1055,10 +1055,6 @@ void mptcp_finish_connect(struct sock *ssk)
 	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
 	WRITE_ONCE(msk->ack_seq, ack_seq);
 	WRITE_ONCE(msk->can_ack, 1);
-	if (inet_sk_state_load(sk) != TCP_ESTABLISHED) {
-		inet_sk_state_store(sk, TCP_ESTABLISHED);
-		sk->sk_state_change(sk);
-	}
 }
 
 static void mptcp_sock_graft(struct sock *sk, struct socket *parent)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 052d72a1d3a2..06b9075333c5 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -109,9 +109,15 @@ static void subflow_v6_init_req(struct request_sock *req,
 static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
+	struct sock *parent = subflow->conn;
 
 	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
 
+	if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
+		inet_sk_state_store(parent, TCP_ESTABLISHED);
+		parent->sk_state_change(parent);
+	}
+
 	if (!subflow->conn_finished) {
 		pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
 			 subflow->remote_key);
-- 
2.24.1


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

* [MPTCP] Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
  2020-03-19 21:45 ` Davide Caratti
@ 2020-03-19 22:48 ` Paolo Abeni
  -1 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2020-03-19 22:48 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

On Thu, 2020-03-19 at 22:45 +0100, Davide Caratti wrote:
> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
> flags/version during the three-way handshake). Adjust MPTCP socket state
> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
> of TCP fallback.
> 
> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
> Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
> ---
>  net/mptcp/protocol.c | 4 ----
>  net/mptcp/subflow.c  | 6 ++++++
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e959104832ef..92d5382e71f4 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1055,10 +1055,6 @@ void mptcp_finish_connect(struct sock *ssk)
>  	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
>  	WRITE_ONCE(msk->ack_seq, ack_seq);
>  	WRITE_ONCE(msk->can_ack, 1);
> -	if (inet_sk_state_load(sk) != TCP_ESTABLISHED) {
> -		inet_sk_state_store(sk, TCP_ESTABLISHED);
> -		sk->sk_state_change(sk);
> -	}
>  }
>  
>  static void mptcp_sock_graft(struct sock *sk, struct socket *parent)
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 052d72a1d3a2..06b9075333c5 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -109,9 +109,15 @@ static void subflow_v6_init_req(struct request_sock *req,
>  static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
>  {
>  	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +	struct sock *parent = subflow->conn;
>  
>  	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
>  
> +	if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
> +		inet_sk_state_store(parent, TCP_ESTABLISHED);
> +		parent->sk_state_change(parent);
> +	}
> +
>  	if (!subflow->conn_finished) {
>  		pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
>  			 subflow->remote_key);

LGTM, thanks Davide!

Acked-by: Paolo Abeni <pabeni(a)redhat.com>

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

* Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
@ 2020-03-19 22:48 ` Paolo Abeni
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Abeni @ 2020-03-19 22:48 UTC (permalink / raw)
  To: Davide Caratti, Mat Martineau, Matthieu Baerts, David S. Miller,
	Jakub Kicinski
  Cc: netdev, mptcp

On Thu, 2020-03-19 at 22:45 +0100, Davide Caratti wrote:
> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
> flags/version during the three-way handshake). Adjust MPTCP socket state
> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
> of TCP fallback.
> 
> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
>  net/mptcp/protocol.c | 4 ----
>  net/mptcp/subflow.c  | 6 ++++++
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e959104832ef..92d5382e71f4 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1055,10 +1055,6 @@ void mptcp_finish_connect(struct sock *ssk)
>  	WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
>  	WRITE_ONCE(msk->ack_seq, ack_seq);
>  	WRITE_ONCE(msk->can_ack, 1);
> -	if (inet_sk_state_load(sk) != TCP_ESTABLISHED) {
> -		inet_sk_state_store(sk, TCP_ESTABLISHED);
> -		sk->sk_state_change(sk);
> -	}
>  }
>  
>  static void mptcp_sock_graft(struct sock *sk, struct socket *parent)
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index 052d72a1d3a2..06b9075333c5 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -109,9 +109,15 @@ static void subflow_v6_init_req(struct request_sock *req,
>  static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
>  {
>  	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
> +	struct sock *parent = subflow->conn;
>  
>  	subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
>  
> +	if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
> +		inet_sk_state_store(parent, TCP_ESTABLISHED);
> +		parent->sk_state_change(parent);
> +	}
> +
>  	if (!subflow->conn_finished) {
>  		pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
>  			 subflow->remote_key);

LGTM, thanks Davide!

Acked-by: Paolo Abeni <pabeni@redhat.com>


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

* [MPTCP] Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
  2020-03-19 22:48 ` Paolo Abeni
@ 2020-03-20 15:54 ` Matthieu Baerts
  -1 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts @ 2020-03-20 15:54 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

On 19/03/2020 23:48, Paolo Abeni wrote:
> On Thu, 2020-03-19 at 22:45 +0100, Davide Caratti wrote:
>> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
>> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
>> flags/version during the three-way handshake). Adjust MPTCP socket state
>> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
>> of TCP fallback.
>>
>> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
>> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
>> Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
> 
> LGTM, thanks Davide!
> 
> Acked-by: Paolo Abeni <pabeni(a)redhat.com>

LGTM too, thanks Davide and Paolo!

Reviewed-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>

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

* Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
@ 2020-03-20 15:54 ` Matthieu Baerts
  0 siblings, 0 replies; 8+ messages in thread
From: Matthieu Baerts @ 2020-03-20 15:54 UTC (permalink / raw)
  To: Paolo Abeni, Davide Caratti, Mat Martineau, David S. Miller,
	Jakub Kicinski
  Cc: netdev, mptcp

On 19/03/2020 23:48, Paolo Abeni wrote:
> On Thu, 2020-03-19 at 22:45 +0100, Davide Caratti wrote:
>> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
>> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
>> flags/version during the three-way handshake). Adjust MPTCP socket state
>> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
>> of TCP fallback.
>>
>> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
>> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
>> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> 
> LGTM, thanks Davide!
> 
> Acked-by: Paolo Abeni <pabeni@redhat.com>

LGTM too, thanks Davide and Paolo!

Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>

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

* [MPTCP] Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
  2020-03-19 21:45 ` Davide Caratti
@ 2020-03-24  3:53 ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2020-03-24  3:53 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

From: Davide Caratti <dcaratti(a)redhat.com>
Date: Thu, 19 Mar 2020 22:45:37 +0100

> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
> flags/version during the three-way handshake). Adjust MPTCP socket state
> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
> of TCP fallback.
> 
> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
> Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>

APplied.

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

* Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
@ 2020-03-24  3:53 ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2020-03-24  3:53 UTC (permalink / raw)
  To: dcaratti; +Cc: mathew.j.martineau, matthieu.baerts, pabeni, kuba, netdev, mptcp

From: Davide Caratti <dcaratti@redhat.com>
Date: Thu, 19 Mar 2020 22:45:37 +0100

> it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
> MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
> flags/version during the three-way handshake). Adjust MPTCP socket state
> earlier, to ensure correct functionality of mptcp_sendmsg() even in case
> of TCP fallback.
> 
> Fixes: 767d3ded5fb8 ("net: mptcp: don't hang before sending 'MP capable with data'")
> Fixes: 1954b86016cf ("mptcp: Check connection state before attempting send")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

APplied.

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

end of thread, other threads:[~2020-03-24  3:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 15:54 [MPTCP] Re: [PATCH net-next] net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback Matthieu Baerts
2020-03-20 15:54 ` Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2020-03-24  3:53 [MPTCP] " David Miller
2020-03-24  3:53 ` David Miller
2020-03-19 22:48 [MPTCP] " Paolo Abeni
2020-03-19 22:48 ` Paolo Abeni
2020-03-19 21:45 [MPTCP] " Davide Caratti
2020-03-19 21:45 ` Davide Caratti

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.