From mboxrd@z Thu Jan 1 00:00:00 1970 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 365ED198E6D; Tue, 19 Nov 2024 08:36:08 +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=1732005369; cv=none; b=lKuwHPLzWB2edWbtc627OvPpVU+MbJ1i6cwwjRkQ5bzGHZhvwCmqcQ0LsP/WaV2oqFyCxsAtrMvHP2x/z5yFJ+iQFhbwWbJkp0mSXznzrk91EKE9YRuHK+OZJLJGzPIik6bZkoU7IG+OJDViybENq+acwEA332gogciWH9L1PIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732005369; c=relaxed/simple; bh=/15lH2bJJx8m56lJc0D3hesy+1WKaqPuHBeEP9sIy5s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F8ebAhdBt8bL7jN/aYH9g6i5aU8D6i1cAhXloRgql8PgAThm8CxpfJLNf+s2qof/PoD4ZHpcFVcFS8E/lxyL6wr5D869Z+h0EoaM1IntcEbdGLvt9GwVGq5cA80b34xI8EuSH3I8IP344boin0WixaUL2Kd/Nz5GyKF7t1ij9T4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cz+SnKpz; 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="Cz+SnKpz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D63AC4CED1; Tue, 19 Nov 2024 08:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732005368; bh=/15lH2bJJx8m56lJc0D3hesy+1WKaqPuHBeEP9sIy5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cz+SnKpzAEUCsLEmGmt8LOzm5jRDWKkcSah1GwqKAdCI1rBlXyXAaRyPTQChxuaXe q8FScICj14HQ5Mom2zMO253utAWSBGSfzN5GjXAzq71F95imaYhcZ7tug/qefAQ1Xh Bp+tNdgw0eDk9Dl+otNcQfoP6p2jgEAkkKzQI43eYeTd7etRGS8xOj9f0C03xcLn1q 6x3MtEXKEqTpBwTMxC4XusJdj7M6O+Sfgh/UtBs3+AKPv85zlWKEQHnXpbPQi8N7pM tXR50QPdSoefsW40SzmXY88uxVzdOfSvL9mVpXYCBO/jTeb/39dRAOHM4WqA3lRdf/ pwMzc8Ykiou7A== From: "Matthieu Baerts (NGI0)" To: mptcp@lists.linux.dev, stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: Geliang Tang , sashal@kernel.org, Matthieu Baerts , Jakub Kicinski Subject: [PATCH 6.1.y 6/7] mptcp: drop lookup_by_id in lookup_addr Date: Tue, 19 Nov 2024 09:35:54 +0100 Message-ID: <20241119083547.3234013-15-matttbe@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241119083547.3234013-9-matttbe@kernel.org> References: <20241119083547.3234013-9-matttbe@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2956; i=matttbe@kernel.org; h=from:subject; bh=xlm5qZmphQDWhCVQKl29IglZRURRJ3MKIL7gFVz2pOM=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBnPE3kFsZXe/P1WN/oeKuP0B4mcmjGoT3Kaas4O X4kIv7PyiOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZzxN5AAKCRD2t4JPQmmg c9aTD/9Xst4sIxQJ6epjSnbFgWZzIf2nbZvZDx1KrbpY5cuwXHcJb5mNSKtQIC5cfPzaE11vmr3 HdVg0BrXk56BbTx/jmq96JiLYbX5ADkpkW+g/P6fSFQu/G7ImDBbr98wc91104VL+LrccFOPbLE x6tPQL9sNEYZDVjflUNJ63DHWKhu9shyOGkWOZJyEDA/NpdP7T/PYYUTMbTofI5LMJ8aSDtOtx2 HZC9GIZpNy7ves28OMVFuGOrZ6DJf2BD2t/FbTrVYlSTSZSL8LdcAliC8Jd24ELCOtsxnclz/qE e/l3EJofJsBNH/ZITWO+DTzDZx4bi4Ou6oYQXu/Y38ISvr8VmxjPB8USeDKYpweR2VcLaQaUr92 MTftOvma5nQ7uXpBq7i/aOa+HUq7h+wznIaOGSJhDva8vVd/N0MbdU1IT95vWPmqO129dAUsH56 W8ZLSUg/pGrsv7WaoYXY6D4aCrV1Oa7dZGWRwGrV062RIv1t3/8Va87hGUIQGGXWJJ70xjx8R85 fKXVBvarce5qrprUoXLDta3HRhszVtXBVifVYIhvN13wDDK4aW3ZOgzoP4Rw8Vl7dt8bwu1uRjo hnTXWQw6Yokzlr7YyTbApi8kMlsJ3Hlv9Go60+cBi+LBg1hswJISpJjMIvq4iH2NM2zAKG7uayR t5H8tHdB/hZP4cQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: 8bit From: Geliang Tang commit af250c27ea1c404e210fc3a308b20f772df584d6 upstream. When the lookup_by_id parameter of __lookup_addr() is true, it's the same as __lookup_addr_by_id(), it can be replaced by __lookup_addr_by_id() directly. So drop this parameter, let __lookup_addr() only looks up address on the local address list by comparing addresses in it, not address ids. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Link: https://lore.kernel.org/r/20240305-upstream-net-next-20240304-mptcp-misc-cleanup-v1-4-c436ba5e569b@kernel.org Signed-off-by: Jakub Kicinski Stable-dep-of: db3eab8110bc ("mptcp: pm: use _rcu variant under rcu_read_lock") [ Conflicts in pm_netlink.c, because commit 6a42477fe449 ("mptcp: update set_flags interfaces") is not in this version, and causes too many conflicts when backporting it. The conflict is easy to resolve: addr is a pointer here here in mptcp_pm_nl_set_flags(), the rest of the code is the same. ] Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 49e8156f5388..9b65d9360976 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -525,15 +525,12 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) } static struct mptcp_pm_addr_entry * -__lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info, - bool lookup_by_id) +__lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) { struct mptcp_pm_addr_entry *entry; list_for_each_entry(entry, &pernet->local_addr_list, list) { - if ((!lookup_by_id && - mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) || - (lookup_by_id && entry->addr.id == info->id)) + if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) return entry; } return NULL; @@ -564,7 +561,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) mptcp_local_address((struct sock_common *)msk->first, &mpc_addr); rcu_read_lock(); - entry = __lookup_addr(pernet, &mpc_addr, false); + entry = __lookup_addr(pernet, &mpc_addr); if (entry) { __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); msk->mpc_endpoint_id = entry->addr.id; @@ -2081,7 +2078,8 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) token, &addr, &remote, bkup); spin_lock_bh(&pernet->lock); - entry = __lookup_addr(pernet, &addr.addr, lookup_by_id); + entry = lookup_by_id ? __lookup_addr_by_id(pernet, addr.addr.id) : + __lookup_addr(pernet, &addr.addr); if (!entry) { spin_unlock_bh(&pernet->lock); return -EINVAL; -- 2.45.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 16F731CC174 for ; Tue, 19 Nov 2024 14:46:45 +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=1732027605; cv=none; b=GXRBH28VrYPT9SE/wxtWVnwIhbdw6BGy6evMJSM5fc959JrHjmq2yyC4dL1uGkJqj5espWPuQH7p6/MRwhNOOOWoFk8Cp3gMyLgfk53g4KuMUWGh10j6Q0pemgVSOdSmv+ovxq2dOyvETCcO5cpQUqvOAMvQpPXIozMBByZ0YYE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732027605; c=relaxed/simple; bh=Vo2xilMbzvaKPObujd+z1M8eYyyDOIVMOTT6EL/gwi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d9mbkvhN3Az2i1Gc0n3SohMszzXLyt/kmNOFctVRaM0Tqr7Ec9PXtJoSzCokIhG+DQwdVFfMrOEUPfbbGPGnYz6N+DIaY/acY263FnuCxq672YYE1RUPBuTMk7KpCSCSn6d9bJRmxPTUyfu8bFnYVUPYIhsu1PsFQKRq/AuosJY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jeNu2NS+; 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="jeNu2NS+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F3DFC4CECF; Tue, 19 Nov 2024 14:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732027604; bh=Vo2xilMbzvaKPObujd+z1M8eYyyDOIVMOTT6EL/gwi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jeNu2NS+iR1OXGpNvCWfzZShnb+ToyZWQbyTiXRSLiXSDnhOEDEAvzVA3nP/CmK6Z 6ajirGNvSFd7D00gxi3ybQLY4X77I9M1AXAUNwxq2oVnUYgvbNPh2l33pO/QGlZq/8 XvGUSdr6coTie+FF/qvpIX+Vhx2Z2t86hwFpF9kwu+3JYf8Zkk/rHY+pfMWqYkReax BVA7wVIJF3XNhBnqgOTLrLTYDjSPtp6NiTzChCQhqPjfde9fAFvNzEj9gDU/5UnIQv bX+aXLWeqWuTo1nzYmsJQJTt3sqznJ0VpzYlw+E4yVOfgVRr3PzXDpVIlijhC+X7Yr RTCPguVvFIX1A== From: Sasha Levin To: stable@vger.kernel.org Cc: "Matthieu Baerts (NGI0)" , Sasha Levin Subject: Re: [PATCH 6.1.y 6/7] mptcp: drop lookup_by_id in lookup_addr Date: Tue, 19 Nov 2024 09:46:42 -0500 Message-ID: <20241119083547.3234013-15-matttbe@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241119083547.3234013-15-matttbe@kernel.org> References: Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: <20241119144642.jai5BpqITcAQLkzhV_mxG2ZjyiqOirmnhz19tFcwEwY@z> [ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: af250c27ea1c404e210fc3a308b20f772df584d6 WARNING: Author mismatch between patch and upstream commit: Backport author: "Matthieu Baerts (NGI0)" Commit author: Geliang Tang Status in newer kernel trees: 6.11.y | Present (exact SHA1) 6.6.y | Not found 6.1.y | Not found Note: The patch differs from the upstream commit: --- --- - 2024-11-19 09:24:03.249399574 -0500 +++ /tmp/tmp.2tsnXkauzv 2024-11-19 09:24:03.244329130 -0500 @@ -1,3 +1,5 @@ +commit af250c27ea1c404e210fc3a308b20f772df584d6 upstream. + When the lookup_by_id parameter of __lookup_addr() is true, it's the same as __lookup_addr_by_id(), it can be replaced by __lookup_addr_by_id() directly. So drop this parameter, let __lookup_addr() only looks up address @@ -8,15 +10,22 @@ Signed-off-by: Matthieu Baerts (NGI0) Link: https://lore.kernel.org/r/20240305-upstream-net-next-20240304-mptcp-misc-cleanup-v1-4-c436ba5e569b@kernel.org Signed-off-by: Jakub Kicinski +Stable-dep-of: db3eab8110bc ("mptcp: pm: use _rcu variant under rcu_read_lock") +[ Conflicts in pm_netlink.c, because commit 6a42477fe449 ("mptcp: update + set_flags interfaces") is not in this version, and causes too many + conflicts when backporting it. The conflict is easy to resolve: addr + is a pointer here here in mptcp_pm_nl_set_flags(), the rest of the + code is the same. ] +Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c -index 354083b8386f0..5c17d39146ea2 100644 +index 49e8156f5388..9b65d9360976 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c -@@ -499,15 +499,12 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) +@@ -525,15 +525,12 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) } static struct mptcp_pm_addr_entry * @@ -34,7 +43,7 @@ return entry; } return NULL; -@@ -537,7 +534,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) +@@ -564,7 +561,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) mptcp_local_address((struct sock_common *)msk->first, &mpc_addr); rcu_read_lock(); @@ -43,8 +52,8 @@ if (entry) { __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); msk->mpc_endpoint_id = entry->addr.id; -@@ -1918,7 +1915,8 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info) - bkup = 1; +@@ -2081,7 +2078,8 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info) + token, &addr, &remote, bkup); spin_lock_bh(&pernet->lock); - entry = __lookup_addr(pernet, &addr.addr, lookup_by_id); @@ -52,4 +61,7 @@ + __lookup_addr(pernet, &addr.addr); if (!entry) { spin_unlock_bh(&pernet->lock); - GENL_SET_ERR_MSG(info, "address not found"); + return -EINVAL; +-- +2.45.2 + --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |