From patchwork Thu Jan 9 14:31:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 1220413 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=2001:19d0:306:5::1; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=strlen.de Received: from ml01.01.org (ml01.01.org [IPv6:2001:19d0:306:5::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47tpTK47b4z9sNx for ; Fri, 10 Jan 2020 01:31:32 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2AFD110097DAF; Thu, 9 Jan 2020 06:34:49 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a0a:51c0:0:12e:520::1; helo=chamillionaire.breakpoint.cc; envelope-from=fw@breakpoint.cc; receiver= Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 744A810097F35 for ; Thu, 9 Jan 2020 06:34:46 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1ipYqL-00042Q-AQ; Thu, 09 Jan 2020 15:31:25 +0100 From: Florian Westphal To: Cc: Florian Westphal Date: Thu, 9 Jan 2020 15:31:13 +0100 Message-Id: <20200109143114.7716-1-fw@strlen.de> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Message-ID-Hash: FJ33MCAPJHPJVQFRNX7R744IJGXX2PGH X-Message-ID-Hash: FJ33MCAPJHPJVQFRNX7R744IJGXX2PGH X-MailFrom: fw@breakpoint.cc X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 1/2] protocol: pm callback must be done after msk state is set up List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Squashto: mptcp: Add path manager interface current location calls this when msk->token is still 0, so pm worker will never find the mptcp socket it should be using. Signed-off-by: Florian Westphal --- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 475ef4c90460..a33c4c58de78 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1371,8 +1371,6 @@ void mptcp_finish_connect(struct sock *ssk) pr_debug("msk=%p, token=%u", sk, subflow->token); - mptcp_pm_new_connection(msk, 0); - mptcp_crypto_key_sha(subflow->remote_key, NULL, &ack_seq); ack_seq++; subflow->map_seq = ack_seq; @@ -1389,6 +1387,8 @@ void mptcp_finish_connect(struct sock *ssk) WRITE_ONCE(msk->ack_seq, ack_seq); WRITE_ONCE(msk->can_ack, 1); atomic64_set(&msk->snd_una, msk->write_seq); + + mptcp_pm_new_connection(msk, 0); } static void mptcp_sock_graft(struct sock *sk, struct socket *parent) From patchwork Thu Jan 9 14:31:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 1220414 X-Patchwork-Delegate: matthieu.baerts@tessares.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.01.org (client-ip=198.145.21.10; helo=ml01.01.org; envelope-from=mptcp-bounces@lists.01.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=strlen.de Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47tpTM1l0Dz9sPJ for ; Fri, 10 Jan 2020 01:31:35 +1100 (AEDT) Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3A6F410097DB8; Thu, 9 Jan 2020 06:34:52 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a0a:51c0:0:12e:520::1; helo=chamillionaire.breakpoint.cc; envelope-from=fw@breakpoint.cc; receiver= Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3F9BF10097DB6 for ; Thu, 9 Jan 2020 06:34:50 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1ipYqP-00042X-Gv; Thu, 09 Jan 2020 15:31:29 +0100 From: Florian Westphal To: Cc: Florian Westphal Date: Thu, 9 Jan 2020 15:31:14 +0100 Message-Id: <20200109143114.7716-2-fw@strlen.de> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200109143114.7716-1-fw@strlen.de> References: <20200109143114.7716-1-fw@strlen.de> MIME-Version: 1.0 Message-ID-Hash: NTMGPZJPQIMKTQOPFI73IJVZPEUW6W5X X-Message-ID-Hash: NTMGPZJPQIMKTQOPFI73IJVZPEUW6W5X X-MailFrom: fw@breakpoint.cc X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list Subject: [MPTCP] [PATCH 2/2] protocol: fix list corruption List-Id: Discussions regarding MPTCP upstreaming Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: squashto: subflow: place further subflows on new 'join_list' plugs: inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. kworker/u8:1/31 [HC0[0]:SC1[1]:HE1:SE0] takes: ffff88810c43d520 (&(&msk->join_list_lock)->rlock){+.?.}, at: mptcp_finish_join+0x30f/0x4d0 and a list corruption, we need to re-init the join list head, else next list_empty() test will splice this a second time, resulting in a corrupted conn list. Signed-off-by: Florian Westphal --- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index a33c4c58de78..6df4eb20916c 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -153,7 +153,7 @@ static void __mptcp_flush_join_list(struct mptcp_sock *msk) return; spin_lock_bh(&msk->join_list_lock); - list_splice_tail(&msk->join_list, &msk->conn_list); + list_splice_tail_init(&msk->join_list, &msk->conn_list); spin_unlock_bh(&msk->join_list_lock); } @@ -1420,9 +1420,9 @@ bool mptcp_finish_join(struct sock *sk) /* active connections are already on conn_list */ if (list_empty(&subflow->node)) { - spin_lock(&msk->join_list_lock); + spin_lock_bh(&msk->join_list_lock); list_add_tail(&subflow->node, &msk->join_list); - spin_unlock(&msk->join_list_lock); + spin_unlock_bh(&msk->join_list_lock); } } return true;