mptcp: fix per socket endpoint accounting
authorPaolo Abeni <pabeni@redhat.com>
Fri, 7 Jan 2022 00:20:20 +0000 (16:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:58 +0000 (11:03 +0100)
commitc310df0eabe5667028c2979d93a31a52cf33d0f2
tree43f0c40f3c35788201f625ac83cc0acfe053b5bc
parentabe4b2c214ea83a89716288956f88b85b33bd04f
mptcp: fix per socket endpoint accounting

[ Upstream commit f7d6a237d7422809d458d754016de2844017cb4d ]

Since full-mesh endpoint support, the reception of a single ADD_ADDR
option can cause multiple subflows creation. When such option is
accepted we increment 'add_addr_accepted' by one. When we received
a paired RM_ADDR option, we deleted all the relevant subflows,
decrementing 'add_addr_accepted' by one for each of them.

We have a similar issue for 'local_addr_used'

Fix them moving the pm endpoint accounting outside the subflow
traversal.

Fixes: 1a0d6136c5f0 ("mptcp: local addresses fullmesh")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mptcp/pm_netlink.c