From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C29C32BDC38; Thu, 31 Jul 2025 11:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961058; cv=none; b=FmkylcbBwzniQSCjjVEu/oVDCTz7hRM4GkkCbgwDHy5bpUdnHpW8Mng9ZVTnLwXOgUI2lfVnakuxBzAG1DDs/NV+TrHjqPUPixU9bJu4ke0MI54kbQw4q/l/Utv2IsfBvGKT50oADyEghXWlyG2z7lzWBpof+zsE3ttP7YqvDDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961058; c=relaxed/simple; bh=QIi4OnFPyi1q9PY3zHhv9AGFDh6nq9BB6EBl5oXwrDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uLxRqbKZeqJ5p40P6njjdD334WECQLL/B19bRR0ZoG5G8ttm0uLtYWfUZuxO39i9ovI4kQxodixRyFGv4HnkAd/HqH/MdnFnqkPZ+v8ShM6yEFIu/06y/xY8czU5NMzJR+50kLHnM8JTbQhBENzSwlF2t9k0SEI0/zDUSeYbJr0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TLe/2p4Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TLe/2p4Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86AFEC4CEF6; Thu, 31 Jul 2025 11:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961058; bh=QIi4OnFPyi1q9PY3zHhv9AGFDh6nq9BB6EBl5oXwrDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TLe/2p4QhhfRgR67Vcu5zTqsledMv0Q994nx+Cw3t4xwpblyAAXjUQw5xAFYo/4k9 GFqLxSGYxUQk60yfVjYSamtVqxZkUuTesCzEKNsNpZ7jbDJLmesu3lBLn0d1ZRIrUy sPpAumPfKJxIGqqyHor9qyGUeS5SCKd1WpHSgN9HaMPzYu/TvGhenwYnkge/3qx6KL H3Weu+TjlkqBLQ6ziNzd4EgFEMoRNRHvnYpUZOOt22WwMK4HzEfItLPS5ogKky9V57 OziFxak9QKXnr/H2jevtnoWdUqejiLVWiTXc3ayvdxFLwcI4YEVsXXvzwT6FpC7z4V S+kvVFeJZV/mw== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Matthieu Baerts , sashal@kernel.org, Paolo Abeni , Mat Martineau , Jakub Kicinski , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 1/6] selftests: mptcp: add missing join check Date: Thu, 31 Jul 2025 13:23:55 +0200 Message-ID: <20250731112353.2638719-9-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2238; i=matttbe@kernel.org; h=from:subject; bh=Tm6WUpa0BQKwE7MrXJ0pzaot8s0NlBN6lvVjqNU5XS8=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6g/y/HJkqq919pfvrsu2nZ137VGv0vV32iD/PqpRTt 8OP7p14oKOUhUGMi0FWTJFFui0yf+bzKt4SLz8LmDmsTCBDGLg4BWAiS+4xMny16JNMO/8ioiZo h+PrVq5jDllMOm+28F/7rPm+6+Y5S1NGhj5zzs7XJsv2irIFJN6ZfOr5oY59szfv+P8mvVHEgcu Xjw0A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Matthieu Baerts commit 857898eb4b28daf3faca3ae334c78b2bb141475e upstream. This function also writes the name of the test with its ID, making clear a new test has been executed. Without that, the ADD_ADDR results from this test was appended at the end of the previous test causing confusions. Especially when the second test was failing, we had: 17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ] add[ ok ] - echo [ ok ] add[fail] got 2 ADD_ADDR[s] expected 3 In fact, this 17th test was OK but not the 18th one. Now we have: 17 signal invalid addresses syn[ ok ] - synack[ ok ] - ack[ ok ] add[ ok ] - echo [ ok ] 18 signal addresses race test syn[fail] got 2 JOIN[s] syn expected 3 - synack[fail] got 2 JOIN[s] synack expected - ack[fail] got 2 JOIN[s] ack expected 3 add[fail] got 2 ADD_ADDR[s] expected 3 Fixes: 33c563ad28e3 ("selftests: mptcp: add_addr and echo race test") Reported-by: Paolo Abeni Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski [ Conflict in mptcp_join.sh, because commit 86e39e04482b ("mptcp: keep track of local endpoint still available for each msk") is not in this version and changed the context. The same line can still be applied at the same place. ] Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 145749460bec..06634417e3c4 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1138,6 +1138,7 @@ signal_address_tests() ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags signal ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr "signal addresses race test" 3 3 3 chk_add_nr 4 4 } =20 --=20 2.50.0 From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10DE2BDC38; Thu, 31 Jul 2025 11:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961060; cv=none; b=ibmIjj5VaWxgILMt4eekmuxyjKtYF+l43zNfv4PnJsU2k8kStodm1yaMXTbfxySP8FH6OQuXzTNZC4YXC9oLiUIMFCD2qGeKODB4Z2HYOHFWzKvKw26UW1pU6RB0iTtghtu+T2XlGmT3INGMXYDcC8pu8TFhAZjCWshAwVuZn6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961060; c=relaxed/simple; bh=dbse7zUs919qfxC/gFPVDKIB9fP3VoYxCZO9GzzqFoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dVU6GB8vvvruGR0na9KqlrJagSNbR7nTIlz8gndbqDRK0dWNXPA041N2kJvoET5Q7HLReZAv1BIKkdEr6RNhHkCnDadM5m+yeUXGD1Yb7o3f0AGvdPnAt4euW7XjzcyN+F47ajOFa9XrS2aULIlrNfpgM5348BIb5sEbuZJ9R5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jvHeWBDo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jvHeWBDo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B322FC4CEF5; Thu, 31 Jul 2025 11:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961060; bh=dbse7zUs919qfxC/gFPVDKIB9fP3VoYxCZO9GzzqFoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jvHeWBDoddwtyzb01+DgXIuKnxqgSN9gXZdBU/n8bDrqfh+6/vceGn/9YN6mHVnCn e3r83Eodd7HZiiPqCP3IMfSpaOkk5z7WxiBXbDT9X1GxLKcyfZM//boAac38l7dqCS mG/bXb/JZeEQ7M3dGvM+nyo6mb1cpMWfwm9kTw7wJxVmYzLFfx6S/OA65FI9lcUeSN +8XTGp+83P6f2yvqq4PASk2v371V2IOp/W2acu1m/IALQsUgWx3xbe6zw57zi7SZLV XJ6qeO6u9ZjgEIs6MzmTr4dZwFbWY0PnncbxHlWDTrBM8PFTSw8Un97m61EjU4RmNq JzHWcDZZFfAWQ== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Paolo Abeni , sashal@kernel.org, Mat Martineau , Jakub Kicinski , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 2/6] mptcp: fix error mibs accounting Date: Thu, 31 Jul 2025 13:23:56 +0200 Message-ID: <20250731112353.2638719-10-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1971; i=matttbe@kernel.org; h=from:subject; bh=Uj3YDf0ZbioOAPY2ydhpobuwIyqvfLAKIyQD7qXqh6A=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6gwLm/zVeO3lV4a+lQrN1nhTJn3gqKiNhLPF2/iaR2 PoZHmE/O0pZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACZiUcTwT8Gs/VD2SdWwg+uc pSLWax9jvvbz/qxinazu5rV2dnd5NjMyrFQR4prw0PlBDCtPHPsyzUBm70xTBU2mp6u+VHodW2H EDQA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit 0c1f78a49af721490a5ad70b73e8b4d382465dae upstream. The current accounting for MP_FAIL and FASTCLOSE is not very accurate: both can be increased even when the related option is not really sent. Move the accounting into the correct place. Fixes: eb7f33654dc1 ("mptcp: add the mibs for MP_FAIL") Fixes: 1e75629cb964 ("mptcp: add the mibs for MP_FASTCLOSE") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski [ Conflicts, because commit f284c0c77321 ("mptcp: implement fastclose xmit path") is not in this version. That's OK, the new helper added by this commit doesn't need to be modified. ] Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 1 + net/mptcp/subflow.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index d1443c5732c8..501c818bf7dc 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -793,6 +793,7 @@ static bool mptcp_established_options_mp_fail(struct so= ck *sk, opts->fail_seq =3D subflow->map_seq; =20 pr_debug("MP_FAIL fail_seq=3D%llu\n", opts->fail_seq); + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX); =20 return true; } diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 2bf7f65b0afe..6a7c48397e3d 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -963,10 +963,8 @@ static enum mapping_status validate_data_csum(struct s= ock *ssk, struct sk_buff * subflow->map_data_csum); if (unlikely(csum)) { MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); - if (subflow->mp_join || subflow->valid_csum_seen) { + if (subflow->mp_join || subflow->valid_csum_seen) subflow->send_mp_fail =3D 1; - MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); - } return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY; } =20 --=20 2.50.0 From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E72D2C0323; Thu, 31 Jul 2025 11:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961062; cv=none; b=IxXPhjn0h8LxINdsYNPh7dEe5gDFO+MYCHKifdgj0p3W0DP9K7SHD7dKmIeMdQOiYuUxXV7ZpetFcqbGiBZJbSanIj2I5+sJHAAm5Fs3NJ3PuiQAxg3kD0qtRI9PCi1AH+7tA/IkfzmuX6gOcOFNAGIovvsXYOoRWUAIZkWIUtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961062; c=relaxed/simple; bh=MPSbPtQjAV2eygYGhFiBQ4sM5BAfTiZnZlyvvgaJ2Ws=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=afrXG7D/cHl28i2f9KQ8tcSJqWY1x19JQI8jNXNJRY7C67V7JyMuIUbrxG+4oJtEWQkpwY3ARzRRr5dwRgjX+6cv2b0dH7On4rYK+cL+ZmYyB8jN2JsXINHvRIZu+3pUTnvYGr0pkSjHobI3Ogygt/ouW4pBNr5u9aRbI+8GH+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A8WtptoK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A8WtptoK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB28DC4CEF7; Thu, 31 Jul 2025 11:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961062; bh=MPSbPtQjAV2eygYGhFiBQ4sM5BAfTiZnZlyvvgaJ2Ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8WtptoKAGCbtIYrcJ/HtZUJ8e1FCnBmIHcFWyWdpG5DLL0O+IHq+r0gjB6pvlhwn 5+m1OnSLhkJDwtTVsaa7WWlOCYIpDXt4nwm3ckDRbxv+5/k3VsL4Kyjz18J/Kaf9kB GfQhCBPRu9bwsWv/I/wH+BpwB9/p7nyRHA8bbAupIZe27V8XYzBO8PyhT6fGIyIixq jYZ3jasZibSkavUGiLC/88pp7coVJ/sGyIk9cVGx2y1ndb8Ne72uigj5+zIbPeGMme hR+bK2n+SOuGsQRndvULo34ISJsGk3ZjWA5jmi1dHuqDY+lgfxyGed+/lTVDru7VdN G+5X3oALKeAeQ== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Paolo Abeni , sashal@kernel.org, Mat Martineau , Jakub Kicinski , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 3/6] mptcp: introduce MAPPING_BAD_CSUM Date: Thu, 31 Jul 2025 13:23:57 +0200 Message-ID: <20250731112353.2638719-11-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2606; i=matttbe@kernel.org; h=from:subject; bh=mLRnr7LXgyI96bAmZqsGlfibrcb7p5Fc95Zh9jlPYpo=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6g4LC5ttkvIu6s/foju+9/nNtza+2VPN5zVofYBoc/ +9VgYxaRykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwET2szL8D/nturG/LOTqku9z npnoF3pxLlitt+zsyTWq7tHXT5uf+8XwV3r+NyUPnwcHZz7M/Z0X/fOIfEp8kuDuw2xMDWLqfkv iWQE= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit 31bf11de146c3f8892093ff39f8f9b3069d6a852 upstream. This allow moving a couple of conditional out of the fast path, making the code more easy to follow and will simplify the next patch. Fixes: ae66fb2ba6c3 ("mptcp: Do TCP fallback on early DSS checksum failure") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski [ Conflicts in subflow.c, because commit 0348c690ed37 ("mptcp: add the fallback check") is not in this version. This commit is linked to a new feature, changing the context around. The new condition can still be added at the same place. ] Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/subflow.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 6a7c48397e3d..6bc36132d490 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -848,7 +848,8 @@ enum mapping_status { MAPPING_INVALID, MAPPING_EMPTY, MAPPING_DATA_FIN, - MAPPING_DUMMY + MAPPING_DUMMY, + MAPPING_BAD_CSUM }; =20 static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn) @@ -963,9 +964,7 @@ static enum mapping_status validate_data_csum(struct so= ck *ssk, struct sk_buff * subflow->map_data_csum); if (unlikely(csum)) { MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); - if (subflow->mp_join || subflow->valid_csum_seen) - subflow->send_mp_fail =3D 1; - return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY; + return MAPPING_BAD_CSUM; } =20 subflow->valid_csum_seen =3D 1; @@ -1188,10 +1187,8 @@ static bool subflow_check_data_avail(struct sock *ss= k) =20 status =3D get_mapping_status(ssk, msk); trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); - if (unlikely(status =3D=3D MAPPING_INVALID)) - goto fallback; - - if (unlikely(status =3D=3D MAPPING_DUMMY)) + if (unlikely(status =3D=3D MAPPING_INVALID || status =3D=3D MAPPING_DUMM= Y || + status =3D=3D MAPPING_BAD_CSUM)) goto fallback; =20 if (status !=3D MAPPING_OK) @@ -1232,7 +1229,10 @@ static bool subflow_check_data_avail(struct sock *ss= k) =20 fallback: /* RFC 8684 section 3.7. */ - if (subflow->send_mp_fail) { + if (status =3D=3D MAPPING_BAD_CSUM && + (subflow->mp_join || subflow->valid_csum_seen)) { + subflow->send_mp_fail =3D 1; + if (mptcp_has_another_subflow(ssk) || !READ_ONCE(msk->allow_infinite_fallback)) { while ((skb =3D skb_peek(&ssk->sk_receive_queue))) --=20 2.50.0 From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4B632BE059; Thu, 31 Jul 2025 11:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961064; cv=none; b=kcSBiTYD3RQkcblq6tZTA05JZpV3dV9b18oR+L5uNu5mgmVYmisJICwSyuAWBHJPBYT+i2kCUO2JsjTLpLZG+ECaUtttjKGkwBPrPXsXlLlLLX3NhOsQEGGM+FOL0PSRg1uJ5mrXv01n9vx7DitMuJROsx+DZqozIoAp3pgZXMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961064; c=relaxed/simple; bh=W4Qda+mvWHWz1R0Gx8QU3A4Dcqty5W8B6mYAXLBraP8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XWwaLMlqAConqiBULFVayAgUj4Yk6sCGSEGpzvs8BROpoZxUGrxWrmDWewRCh549/CR4BV4ViCeYznh91wKEdQ7lkKdbwm/fU5WoJcqvhDfRxU7yRfzjbocc9HOZJITv8WuaLHdPcHcFsRxHvGIYcd8pqhqtSV+pR1lPyC3eEdo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=clJO9CtD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="clJO9CtD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3011C4CEEF; Thu, 31 Jul 2025 11:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961064; bh=W4Qda+mvWHWz1R0Gx8QU3A4Dcqty5W8B6mYAXLBraP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clJO9CtDo4m+ezGVawoUJp7OcRNwVzyZrsIoI8P9XrxEVQ82Eb4opfG+8xT+sMHSw Z5eqpG+73pWxQUDunbU679K0YAJ1snh8AkMwFTOPdHl+E3bWaowT4W57r5jmn1zUw7 r8sN19qjTAbAjHjH9IH5yL4xCM+wu7tDcux2t+l6tGBSIdZyoz8uYOUhzvPE7XSMtE bhZokE7fOUGbgqmZHCHZGcIbjpDkRZTzgDbNy3Nc9kQs3NEr2kIzO2WVsdcCUUxpP1 plQSN18xdshdPK8Dt3a3b2C6VyUbBynnmYMpN9co/FQjxKxb5zAj6I7dfUbQ1T5Edx aQdJ8B5yHoaeA== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Mat Martineau , sashal@kernel.org, Paolo Abeni , Jakub Kicinski , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 4/6] selftests: mptcp: Initialize variables to quiet gcc 12 warnings Date: Thu, 31 Jul 2025 13:23:58 +0200 Message-ID: <20250731112353.2638719-12-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1545; i=matttbe@kernel.org; h=from:subject; bh=uA3dGsq1KQVY/0mRDNfeGEq/tEmcX9yXO+wq962/Iic=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6g4Ilbl4pt62vyubVZF8VcGrjE4tJTeY7L5w2mfgvN mHGQ86+jlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIksamVk+B6jK3gy3bPj2JGg PWf+bs6913bti4xmzcvZqW9rzrest2X4X8habp1QqMlRs+jgo/BJ+mY70wRstiuuelUpIXTh2eN d/AA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mat Martineau commit fd37c2ecb21f7aee04ccca5f561469f07d00063c upstream. In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable might be used uninitialized. This is a false positive because the only code path that could lead to uninitialized access is where getaddrinfo() fails, but the local xgetaddrinfo() wrapper exits if such a failure occurs. Initialize the 'sock' variable anyway to allow the tools to build with gcc 12. Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp") Acked-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski [ mptcp_inq.c and mptcp_sockopt.c are not in this version. The fix can still be applied in mptcp_connect.c without conflicts. ] Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/test= ing/selftests/net/mptcp/mptcp_connect.c index 95e81d557b08..599befcc1c4d 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -188,7 +188,7 @@ static void set_mark(int fd, uint32_t mark) static int sock_listen_mptcp(const char * const listenaddr, const char * const port) { - int sock; + int sock =3D -1; struct addrinfo hints =3D { .ai_protocol =3D IPPROTO_TCP, .ai_socktype =3D SOCK_STREAM, --=20 2.50.0 From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F13F82BDC38; Thu, 31 Jul 2025 11:24:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961067; cv=none; b=cTbY/iM9lTi+8wtEArW9gfrqVIvUIiu6YzlFYiSxOM/Xa2e/2tSjW8f7hQlZLDu34PEXuStBUgtGoa5eOSlVzLHL7B0lfci7ghI2ZnnldhOIO0MOoSHvnQZPs787PR4SdLuCQCVZKhR4Dvaa8g1EawPitQu4M/kojNyf0iMVb9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961067; c=relaxed/simple; bh=qsuwWXAEWIUGdv6z5360HT5Jt2fvcIuLGXiOq1jBtO8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cukG+URVUXTroY5hE42BfozZwxj2gwt/FsiOrVlYsyzHycJJzrCQkIDSMQpBU8V4+uLUfvHh+ipIbnpEar7ilqPThRQdXuYOedItMcOxt/LM8dicvKiM0+KtB991w/9iZIzWryRfSTk0tLux6ajIvLtlOVeP3VcadGvjKYPqK/U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QFtD+14T; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QFtD+14T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C77AEC4CEF9; Thu, 31 Jul 2025 11:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961066; bh=qsuwWXAEWIUGdv6z5360HT5Jt2fvcIuLGXiOq1jBtO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QFtD+14TaYHtUB6on4nPIafpHvUfUYluHdf/sgPNEQyFn9i1bHmV+Aj9VFvWZlFM3 WiU8m5wQRzzPhKzlnUHzvSaz8xe8yk8jzbJ/OUprIk+sJTqI8GSzZ5H2DBS5CjGOKx 1S6Mo41ETzSzxgQDBqFi9/GLiZasY4uIIBCwDGJk0Te+Fg8nY8WqvQp7dzi5xy6hwN bEK0VeRZw1UOjAWJEhwldTnElb8M2BZNC3GlP4VQdUY1q++1Y5qecTek2KEikOKLQV dz54v3HZhEKfxca1ScuCoy4obrF4z6u3o1KBmL2dRrqVVbknqwEVCwUATaaanQglfe DT7s8QF+wF8Jw== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Geliang Tang , sashal@kernel.org, Matthieu Baerts , Mat Martineau , Jakub Kicinski , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 5/6] mptcp: drop unused sk in mptcp_push_release Date: Thu, 31 Jul 2025 13:23:59 +0200 Message-ID: <20250731112353.2638719-13-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2226; i=matttbe@kernel.org; h=from:subject; bh=8BnuahpnPWZHdWUWpoSh5WXCdjsdDHoVpCUrBM9zpq4=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6g0J3qOx/PuU4RxrPpOppx4x7/I2qln9OKplVovs7M vKsumV+RykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwERMjjAynFrk/faJtGF9ZNki /m0LnWc7Z155eE3gQMxS9ivO59xkShkZ3v9wtFzcXxO6grVq97ZJPjriJ9hPL/t4RnCWg/c0Z76 7DAA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang commit b8e0def397d7753206b1290e32f73b299a59984c upstream. Since mptcp_set_timeout() had removed from mptcp_push_release() in commit 33d41c9cd74c5 ("mptcp: more accurate timeout"), the argument sk in mptcp_push_release() became useless. Let's drop it. Fixes: 33d41c9cd74c5 ("mptcp: more accurate timeout") Reviewed-by: Matthieu Baerts Signed-off-by: Geliang Tang Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski Stable-dep-of: c886d70286bf ("mptcp: do not queue data on closed subflows") Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index c6a11d6df516..6e9d1a749950 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1568,8 +1568,7 @@ static struct sock *mptcp_subflow_get_send(struct mpt= cp_sock *msk) return NULL; } =20 -static void mptcp_push_release(struct sock *sk, struct sock *ssk, - struct mptcp_sendmsg_info *info) +static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info= *info) { tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); release_sock(ssk); @@ -1626,7 +1625,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) * the last round, release prev_ssk */ if (ssk !=3D prev_ssk && prev_ssk) - mptcp_push_release(sk, prev_ssk, &info); + mptcp_push_release(prev_ssk, &info); if (!ssk) goto out; =20 @@ -1639,7 +1638,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) =20 ret =3D mptcp_sendmsg_frag(sk, ssk, dfrag, &info); if (ret <=3D 0) { - mptcp_push_release(sk, ssk, &info); + mptcp_push_release(ssk, &info); goto out; } =20 @@ -1654,7 +1653,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) =20 /* at this point we held the socket lock for the last subflow we used */ if (ssk) - mptcp_push_release(sk, ssk, &info); + mptcp_push_release(ssk, &info); =20 out: /* ensure the rtx timer is running */ --=20 2.50.0 From nobody Wed Sep 17 18:16:52 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB78F2BDC38; Thu, 31 Jul 2025 11:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961069; cv=none; b=j2c6ph1T/oFU51axozmn+kg/Df4X/SugKrwQwivbaoA48ZXT4OdEImrFM/MK7S9A86d+1RRlurtd/VAMHD2evVEWt81CMhp4AXGVLXM50h70E5oWQSnPgvecucb4oFNIo8dof5nWK3DUOOwMG1oP6yMg0ECGINcao8SZdnOw2N4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753961069; c=relaxed/simple; bh=p4f9HLKx6WzT9jNMNqLMGwTM73cjvY8OTDsMvc7A11M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k3JjzXGlgai4lfpkhDReCyhLdPSUAsoQiZL9noLQwMIOrpQ2WrzEMm/UJ482VqW5jAQ7p9qiFq1tZZzzeh2y2KP0xQnR81wR/Oy/H7WZg09RbZc5B31UTC+NXDa+eN6vX1XnXr1P6dAveEPRHfrGUfPgZpf+xGfKV822mViQdP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UDyf6dNZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UDyf6dNZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3F95C4CEF6; Thu, 31 Jul 2025 11:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753961068; bh=p4f9HLKx6WzT9jNMNqLMGwTM73cjvY8OTDsMvc7A11M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UDyf6dNZPoUMKXr97mF6WboHWiOtgh3i2Fir1tpCamsOxWgWQznwRkxzEp0MtaiRy h6FI4awdIhbVOMW/BzejNG+XwcBn2zj1ctjbBFqx+PFrV7dAPX1YnDzynC1fIm6ICF LoRDSI3qk9yumIAzLZFlhVk6G9NXpIgxwVJay79qbW3aO9MXUavMC1zC2fA1+kaqMN wGtAYlkgucj2EKHanIKg6ArdRIkzWiPLlH4caU7RrFo/1gWmYgy/yCo5L+fUwF2SMp rRYLfsjCWRYlkMHFayQ+DDBE75G1gxY4454p3zz7/7DvEqSlRQuCzCeZB8NcFgh1rj HuKVgPSW6V6dQ== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Paolo Abeni , sashal@kernel.org, Dipanjan Das , Mat Martineau , "David S. Miller" , "Matthieu Baerts (NGI0)" Subject: [PATCH 5.15.y 6/6] mptcp: do not queue data on closed subflows Date: Thu, 31 Jul 2025 13:24:00 +0200 Message-ID: <20250731112353.2638719-14-matttbe@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250731112353.2638719-8-matttbe@kernel.org> References: <20250731112353.2638719-8-matttbe@kernel.org> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5163; i=matttbe@kernel.org; h=from:subject; bh=U0XNF1CDFKt2Tpezty8ofYSiZ9LjPTlhIFxPrOSkEQY=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDK6g8KqwwVcVy9eMn3uB/7vS4/F2ETyb2uSrvjxL5Hz5 4GJXMEbO0pZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACZyKIKRob/1c/yUqlmy5ox3 nri8ybzps/F911+vm6ti1ofm7PJ+U83I8HAZ/5T2/Ei5uWevnVtw103hzffGXw69lzvnu/9ItF+ 9mg8A X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Paolo Abeni commit c886d70286bf3ad411eb3d689328a67f7102c6ae upstream. Dipanjan reported a syzbot splat at close time: WARNING: CPU: 1 PID: 10818 at net/ipv4/af_inet.c:153 inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153 Modules linked in: uio_ivshmem(OE) uio(E) CPU: 1 PID: 10818 Comm: kworker/1:16 Tainted: G OE 5.19.0-rc6-g2eae0556bb9d #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Workqueue: events mptcp_worker RIP: 0010:inet_sock_destruct+0x6d0/0x8e0 net/ipv4/af_inet.c:153 Code: 21 02 00 00 41 8b 9c 24 28 02 00 00 e9 07 ff ff ff e8 34 4d 91 f9 89 ee 4c 89 e7 e8 4a 47 60 ff e9 a6 fc ff ff e8 20 4d 91 f9 <0f> 0b e9 84 fe ff ff e8 14 4d 91 f9 0f 0b e9 d4 fd ff ff e8 08 4d RSP: 0018:ffffc9001b35fa78 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 00000000002879d0 RCX: ffff8881326f3b00 RDX: 0000000000000000 RSI: ffff8881326f3b00 RDI: 0000000000000002 RBP: ffff888179662674 R08: ffffffff87e983a0 R09: 0000000000000000 R10: 0000000000000005 R11: 00000000000004ea R12: ffff888179662400 R13: ffff888179662428 R14: 0000000000000001 R15: ffff88817e38e258 FS: 0000000000000000(0000) GS:ffff8881f5f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020007bc0 CR3: 0000000179592000 CR4: 0000000000150ee0 Call Trace: __sk_destruct+0x4f/0x8e0 net/core/sock.c:2067 sk_destruct+0xbd/0xe0 net/core/sock.c:2112 __sk_free+0xef/0x3d0 net/core/sock.c:2123 sk_free+0x78/0xa0 net/core/sock.c:2134 sock_put include/net/sock.h:1927 [inline] __mptcp_close_ssk+0x50f/0x780 net/mptcp/protocol.c:2351 __mptcp_destroy_sock+0x332/0x760 net/mptcp/protocol.c:2828 mptcp_worker+0x5d2/0xc90 net/mptcp/protocol.c:2586 process_one_work+0x9cc/0x1650 kernel/workqueue.c:2289 worker_thread+0x623/0x1070 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 The root cause of the problem is that an mptcp-level (re)transmit can race with mptcp_close() and the packet scheduler checks the subflow state before acquiring the socket lock: we can try to (re)transmit on an already closed ssk. Fix the issue checking again the subflow socket status under the subflow socket lock protection. Additionally add the missing check for the fallback-to-tcp case. Fixes: d5f49190def6 ("mptcp: allow picking different xmit subflows") Reported-by: Dipanjan Das Reviewed-by: Mat Martineau Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 8 +++++++- net/mptcp/protocol.h | 11 +++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6e9d1a749950..bf2b9ba1c734 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1350,6 +1350,9 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct= sock *ssk, info->limit > dfrag->data_len)) return 0; =20 + if (unlikely(!__tcp_can_send(ssk))) + return -EAGAIN; + /* compute send limit */ info->mss_now =3D tcp_send_mss(ssk, &info->size_goal, info->flags); copy =3D info->size_goal; @@ -1512,7 +1515,8 @@ static struct sock *mptcp_subflow_get_send(struct mpt= cp_sock *msk) if (__mptcp_check_fallback(msk)) { if (!msk->first) return NULL; - return sk_stream_memory_free(msk->first) ? msk->first : NULL; + return __tcp_can_send(msk->first) && + sk_stream_memory_free(msk->first) ? msk->first : NULL; } =20 /* re-use last subflow, if the burst allow that */ @@ -1638,6 +1642,8 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) =20 ret =3D mptcp_sendmsg_frag(sk, ssk, dfrag, &info); if (ret <=3D 0) { + if (ret =3D=3D -EAGAIN) + continue; mptcp_push_release(ssk, &info); goto out; } diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index cfb6aa72515e..8d05fb205a31 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -599,16 +599,19 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info= *info, struct sockaddr_storage *addr, unsigned short family); =20 +static inline bool __tcp_can_send(const struct sock *ssk) +{ + /* only send if our side has not closed yet */ + return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_W= AIT)); +} + static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *su= bflow) { - struct sock *ssk =3D mptcp_subflow_tcp_sock(subflow); - /* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */ if (subflow->request_join && !subflow->fully_established) return false; =20 - /* only send if our side has not closed yet */ - return ((1 << ssk->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); + return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); } =20 void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow); --=20 2.50.0