From: Josef Bacik <jos…@toxicpanda.com>
The worker clears MPTCP_PM_RM_ADDR_RECEIVED and walks pm.rm_list_rx in
place. For every subflow it closes, mptcp_pm_rm_addr_or_subflow() drops
pm.lock. If the peer's next RM_ADDR arrives then, the flag is clear and
mptcp_pm_rm_addr_received() overwrites the list. The walk goes on at
its index in the new list: the ids of the first list that were still to
come are never handled, and their subflows stay.
Hand a copy of the list to the walk.
This issue has been found with the help of an LLM. It has not been
reproduced: the next RM_ADDR has to be processed while the worker has
dropped pm.lock to close a subflow, a window that a Packetdrill script
cannot target. This fix is based on code inspection only, which is
acceptable here: it is simple, and the issue is clear from the code.
Fixes: d0b698ca9a27 ("mptcp: remove multi addresses in PM")
Signed-off-by: Josef Bacik <jos…@toxicpanda.com>
[ Commit message: how the issue was found, and why it is fine without
a reproducer. ]
Signed-off-by: Matthieu Baerts (NGI0) <matt…@kernel.org>
---
net/mptcp/pm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index b0b71adefb8f..fd8dc1132ad1 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -827,7 +827,10 @@ static void mptcp_pm_rm_addr_or_subflow(struct mptcp_sock *msk,
static void mptcp_pm_rm_addr_recv(struct mptcp_sock *msk)
{
- mptcp_pm_rm_addr_or_subflow(msk, &msk->pm.rm_list_rx, MPTCP_MIB_RMADDR);
+ /* pm.lock is dropped on the way: the next RM_ADDR may come in */
+ struct mptcp_rm_list rm_list = msk->pm.rm_list_rx;
+
+ mptcp_pm_rm_addr_or_subflow(msk, &rm_list, MPTCP_MIB_RMADDR);
}
void mptcp_pm_rm_subflow(struct mptcp_sock *msk,
--
2.55.0