[PATCH mptcp-net v6 01/11] Squash to "mptcp: pm: re-using ID of unused removed ADD_ADDR"

Matthieu Baerts (NGI0) posted 11 patches 4 months ago
There is a newer version of this series
[PATCH mptcp-net v6 01/11] Squash to "mptcp: pm: re-using ID of unused removed ADD_ADDR"
Posted by Matthieu Baerts (NGI0) 4 months ago
It looks better to mark the addr ID as available in
mptcp_pm_remove_anno_addr(), where we decrement pm.add_addr_signaled:
this helper is only used by the in-kernel PM (compared to the previous
one), and the mark was only done if an entry was found, which will not
be the case if the entry of the initial subflow is removed while now, it
will be done because 'force' will be set.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_netlink.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 469a16326b3f..3e552b4f1a21 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1423,11 +1423,6 @@ static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
 
 	entry = mptcp_pm_del_add_timer(msk, addr, false);
 	if (entry) {
-		spin_lock_bh(&msk->pm.lock);
-		__set_bit(entry->addr.id ? : msk->mpc_endpoint_id,
-			  msk->pm.id_avail_bitmap);
-		spin_unlock_bh(&msk->pm.lock);
-
 		list_del(&entry->list);
 		kfree(entry);
 		return true;
@@ -1448,6 +1443,7 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk,
 	ret = remove_anno_list_by_saddr(msk, addr);
 	if (ret || force) {
 		spin_lock_bh(&msk->pm.lock);
+		__set_bit(addr->id, msk->pm.id_avail_bitmap);
 		msk->pm.add_addr_signaled -= ret;
 		mptcp_pm_remove_addr(msk, &list);
 		spin_unlock_bh(&msk->pm.lock);

-- 
2.45.2