Skip to content

Commit 167b932

Browse files
Paolo Abenidavem330
authored andcommitted
mptcp: fix user-space PM announced address accounting
Currently the per-connection announced address counter is never decreased. When the user-space PM is in use, this just affect the information exposed via diag/sockopt, but it could still foul the PM to wrong decision. Add the missing accounting for the user-space PM's sake. Fixes: 8b1c94d ("mptcp: only send RM_ADDR in nl_cmd_remove") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9415d37 commit 167b932

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

net/mptcp/pm_netlink.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,16 +1534,25 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
15341534
{
15351535
struct mptcp_rm_list alist = { .nr = 0 };
15361536
struct mptcp_pm_addr_entry *entry;
1537+
int anno_nr = 0;
15371538

15381539
list_for_each_entry(entry, rm_list, list) {
1539-
if ((remove_anno_list_by_saddr(msk, &entry->addr) ||
1540-
lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) &&
1541-
alist.nr < MPTCP_RM_IDS_MAX)
1542-
alist.ids[alist.nr++] = entry->addr.id;
1540+
if (alist.nr >= MPTCP_RM_IDS_MAX)
1541+
break;
1542+
1543+
/* only delete if either announced or matching a subflow */
1544+
if (remove_anno_list_by_saddr(msk, &entry->addr))
1545+
anno_nr++;
1546+
else if (!lookup_subflow_by_saddr(&msk->conn_list,
1547+
&entry->addr))
1548+
continue;
1549+
1550+
alist.ids[alist.nr++] = entry->addr.id;
15431551
}
15441552

15451553
if (alist.nr) {
15461554
spin_lock_bh(&msk->pm.lock);
1555+
msk->pm.add_addr_signaled -= anno_nr;
15471556
mptcp_pm_remove_addr(msk, &alist);
15481557
spin_unlock_bh(&msk->pm.lock);
15491558
}

0 commit comments

Comments
 (0)