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

Matthieu Baerts (NGI0) posted 10 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH mptcp-net 01/10] Squash to "mptcp: pm: re-using ID of unused removed ADD_ADDR"
Posted by Matthieu Baerts (NGI0) 3 months, 1 week ago
When removing an announced ADD_ADDR, the ID should be marked as
available only if it was announced before. Otherwise, local_addr_used
will not be decremented when removing the endpoint.

That's somehow the behaviour we had from the original patch, before the
previous Squash-to patch [1].

Link: https://lore.kernel.org/20240802-mptcp-pm-avail-v6-1-964ba9ce279f@kernel.org [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index d3b1b459e6f3..0881983f505d 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1455,8 +1455,10 @@ 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;
+		if (ret) {
+			__set_bit(addr->id, msk->pm.id_avail_bitmap);
+			msk->pm.add_addr_signaled--;
+		}
 		mptcp_pm_remove_addr(msk, &list);
 		spin_unlock_bh(&msk->pm.lock);
 	}

-- 
2.45.2