All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: mptcp@lists.linux.dev, stable@vger.kernel.org,
	gregkh@linuxfoundation.org
Cc: Geliang Tang <tanggeliang@kylinos.cn>,
	sashal@kernel.org, Matthieu Baerts <matttbe@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 6.1.y 6/7] mptcp: drop lookup_by_id in lookup_addr
Date: Tue, 19 Nov 2024 09:35:54 +0100	[thread overview]
Message-ID: <20241119083547.3234013-15-matttbe@kernel.org> (raw)
In-Reply-To: <20241119083547.3234013-9-matttbe@kernel.org>

From: Geliang Tang <tanggeliang@kylinos.cn>

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 <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240305-upstream-net-next-20240304-mptcp-misc-cleanup-v1-4-c436ba5e569b@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
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) <matttbe@kernel.org>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
	Sasha Levin <sashal@kernel.org>
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	[thread overview]
Message-ID: <20241119083547.3234013-15-matttbe@kernel.org> (raw)
Message-ID: <20241119144642.jai5BpqITcAQLkzhV_mxG2ZjyiqOirmnhz19tFcwEwY@z> (raw)
In-Reply-To: <20241119083547.3234013-15-matttbe@kernel.org>

[ 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)" <matttbe@kernel.org>
Commit author: Geliang Tang <tanggeliang@kylinos.cn>


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) <matttbe@kernel.org>
 Link: https://lore.kernel.org/r/20240305-upstream-net-next-20240304-mptcp-misc-cleanup-v1-4-c436ba5e569b@kernel.org
 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+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) <matttbe@kernel.org>
 ---
  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   |

  parent reply	other threads:[~2024-11-19  8:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19  8:35 [PATCH 6.1.y 0/7] mptcp: fix recent failed backports Matthieu Baerts (NGI0)
2024-11-19  8:35 ` [PATCH 6.1.y 1/7] mptcp: cope racing subflow creation in mptcp_rcv_space_adjust Matthieu Baerts (NGI0)
2024-11-19 14:46   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: cope racing subflow creation in mptcp_rcv_space_adjust" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` [PATCH 6.1.y 2/7] mptcp: define more local variables sk Matthieu Baerts (NGI0)
2024-11-19 14:46   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: define more local variables sk" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` [PATCH 6.1.y 3/7] mptcp: add userspace_pm_lookup_addr_by_id helper Matthieu Baerts (NGI0)
2024-11-19 14:46   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: add userspace_pm_lookup_addr_by_id helper" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` [PATCH 6.1.y 4/7] mptcp: update local address flags when setting it Matthieu Baerts (NGI0)
2024-11-19 14:46   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: update local address flags when setting it" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` [PATCH 6.1.y 5/7] mptcp: hold pm lock when deleting entry Matthieu Baerts (NGI0)
2024-11-19 14:46   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: hold pm lock when deleting entry" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` Matthieu Baerts (NGI0) [this message]
2024-11-19 14:46   ` [PATCH 6.1.y 6/7] mptcp: drop lookup_by_id in lookup_addr Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: drop lookup_by_id in lookup_addr" has been added to the 6.1-stable tree gregkh
2024-11-19  8:35 ` [PATCH 6.1.y 7/7] mptcp: pm: use _rcu variant under rcu_read_lock Matthieu Baerts (NGI0)
2024-11-19 14:47   ` Sasha Levin
2024-11-19 13:12   ` Patch "mptcp: pm: use _rcu variant under rcu_read_lock" has been added to the 6.1-stable tree gregkh
2024-11-19 13:05 ` [PATCH 6.1.y 0/7] mptcp: fix recent failed backports Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241119083547.3234013-15-matttbe@kernel.org \
    --to=matttbe@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tanggeliang@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.