Commit 167b9325 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

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: 8b1c94da ("mptcp: only send RM_ADDR in nl_cmd_remove")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9415d375
...@@ -1534,16 +1534,25 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) ...@@ -1534,16 +1534,25 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list)
{ {
struct mptcp_rm_list alist = { .nr = 0 }; struct mptcp_rm_list alist = { .nr = 0 };
struct mptcp_pm_addr_entry *entry; struct mptcp_pm_addr_entry *entry;
int anno_nr = 0;
list_for_each_entry(entry, rm_list, list) { list_for_each_entry(entry, rm_list, list) {
if ((remove_anno_list_by_saddr(msk, &entry->addr) || if (alist.nr >= MPTCP_RM_IDS_MAX)
lookup_subflow_by_saddr(&msk->conn_list, &entry->addr)) && break;
alist.nr < MPTCP_RM_IDS_MAX)
alist.ids[alist.nr++] = entry->addr.id; /* only delete if either announced or matching a subflow */
if (remove_anno_list_by_saddr(msk, &entry->addr))
anno_nr++;
else if (!lookup_subflow_by_saddr(&msk->conn_list,
&entry->addr))
continue;
alist.ids[alist.nr++] = entry->addr.id;
} }
if (alist.nr) { if (alist.nr) {
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
msk->pm.add_addr_signaled -= anno_nr;
mptcp_pm_remove_addr(msk, &alist); mptcp_pm_remove_addr(msk, &alist);
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment