summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>2024-08-19 22:45:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-04 14:24:59 +0300
commitc1dce071875ddf3aa15ab1bb77e71bcf685117e8 (patch)
treea61e3f35fe03cdb34c5f73f3fb83c2abf863b885
parent7fdc870d08960961408a44c569f20f50940e7d4f (diff)
downloadlinux-c1dce071875ddf3aa15ab1bb77e71bcf685117e8.tar.xz
mptcp: pm: check add_addr_accept_max before accepting new ADD_ADDR
[ Upstream commit 0137a3c7c2ea3f9df8ebfc65d78b4ba712a187bb ] The limits might have changed in between, it is best to check them before accepting new ADD_ADDR. Fixes: d0876b2284cf ("mptcp: add the incoming RM_ADDR support") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20240819-net-mptcp-pm-reusing-id-v1-10-38035d40de5b@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/mptcp/pm_netlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index d546e17063f7..9e16ae1b23fc 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -870,8 +870,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
/* Note: if the subflow has been closed before, this
* add_addr_accepted counter will not be decremented.
*/
- msk->pm.add_addr_accepted--;
- WRITE_ONCE(msk->pm.accept_addr, true);
+ if (--msk->pm.add_addr_accepted < mptcp_pm_get_add_addr_accept_max(msk))
+ WRITE_ONCE(msk->pm.accept_addr, true);
}
}
}