All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [PATCH v3 02/10] Fix locking in mptcp_finish_join.
@ 2019-08-07 22:44 Peter Krystad
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Krystad @ 2019-08-07 22:44 UTC (permalink / raw)
  To: mptcp 

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

Lock was being taken on the subflow sock, not mptcp_sock.

squashto:  Add handling of incoming MP_JOIN requests

Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
 net/mptcp/protocol.c | 9 +++++----
 net/mptcp/protocol.h | 2 +-
 net/mptcp/subflow.c  | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 5501c405c6e0..8a841d489b52 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -816,18 +816,19 @@ void mptcp_finish_connect(struct sock *sk, int mp_capable)
 	inet_sk_state_store(sk, TCP_ESTABLISHED);
 }
 
-void mptcp_finish_join(struct sock *conn, struct sock *sk)
+void mptcp_finish_join(struct sock *sk)
 {
 	struct subflow_context *subflow = subflow_ctx(sk);
-	struct mptcp_sock *msk = mptcp_sk(conn);
+	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
 
 	pr_debug("msk=%p, subflow=%p", msk, subflow);
 
 	local_bh_disable();
-	bh_lock_sock_nested(sk);
+	bh_lock_sock_nested(subflow->conn);
 	list_add_tail(&subflow->node, &msk->conn_list);
-	bh_unlock_sock(sk);
+	bh_unlock_sock(subflow->conn);
 	local_bh_enable();
+	inet_sk_state_store(sk, TCP_ESTABLISHED);
 }
 
 bool mptcp_sk_is_subflow(const struct sock *sk)
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 71c86e31e19c..dedd3524e4a2 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -210,7 +210,7 @@ void mptcp_get_options(const struct sk_buff *skb,
 		       struct tcp_options_received *opt_rx);
 
 void mptcp_finish_connect(struct sock *sk, int mp_capable);
-void mptcp_finish_join(struct sock *conn, struct sock *sk);
+void mptcp_finish_join(struct sock *sk);
 
 void token_init(void);
 void token_new_request(struct request_sock *req, const struct sk_buff *skb);
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index d91d817b8779..9d91014c0d1b 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -165,7 +165,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 			if (token_new_join(child))
 				goto close_child;
 			else
-				mptcp_finish_join(ctx->conn, child);
+				mptcp_finish_join(child);
 		}
 	}
 
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread
* Re: [MPTCP] [PATCH v3 02/10] Fix locking in mptcp_finish_join.
@ 2019-08-12 19:35 Matthieu Baerts
  0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2019-08-12 19:35 UTC (permalink / raw)
  To: mptcp 

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

Hi Peter, Paolo, Mat,

On 08/08/2019 00:44, Peter Krystad wrote:
> Lock was being taken on the subflow sock, not mptcp_sock.
> 
> squashto:  Add handling of incoming MP_JOIN requests

Thank you for the patch and the reviews!

- 590cbe28643f: "squashed" in "mptcp: Add handling of incoming MP_JOIN
requests"
- 711ae3fdd44f..34fd270ae102: result

Cheers,
Matt
-- 
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium

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

end of thread, other threads:[~2019-08-12 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-07 22:44 [MPTCP] [PATCH v3 02/10] Fix locking in mptcp_finish_join Peter Krystad
  -- strict thread matches above, loose matches on Subject: below --
2019-08-12 19:35 Matthieu Baerts

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.