From: Josef Bacik <jos…@toxicpanda.com> mptcp_pm_remove_addr() gives up, and counts RmAddrTxDrop, if any bit of pm.addr_signal is set. That dates from the time when the byte was cleared as a whole after a signal had been sent. Since commit 119c022096f5 ("mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other") an ADD_ADDR, an echo and an RM_ADDR each clear their own bit, and they have storage of their own: pm.local, pm.remote and pm.rm_list_tx. mptcp_pm_announce_addr() looks at its own bit only. The callers have updated their state by then and ignore the result: the endpoint is gone, the announcement is forgotten, and the peer never learns that the address is not valid any more. When the bit of an echo is set at the arrival of the peer's ADD_ADDR, it stays set until the PM worker has sent the ACK. An endpoint that is removed in between loses its RM_ADDR. Only a pending RM_ADDR stands in the way, as rm_list_tx would be overwritten. The ACK that is sent at once carries the ADD_ADDR or the echo then, and the RM_ADDR goes with a later packet. That is fine: an ADD_ADDR, an echo and an RM_ADDR should rarely have to be sent at the same time. This issue has been found with the help of an LLM. It has not been reproduced: the endpoint has to be removed before the PM worker sends the pending ADD_ADDR or echo, a window that a Packetdrill script cannot target. This fix is based on code inspection only, which is acceptable here: the issue is clear from the code, and the fix is a one-liner. Fixes: 119c022096f5 ("mptcp: fix ADD_ADDR and RM_ADDR maybe flush addr_signal each other") Signed-off-by: Josef Bacik <jos…@toxicpanda.com> [ Use mptcp_pm_should_rm_signal() instead of a comment. Fixes tag: 119c022096f5 instead of 42842a425ad6. Commit message: remove the number of attempts, say which packet carries the RM_ADDR then, and when the echo bit is set + 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index dacd3cf358f5..f12a8bfbb2a9 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -529,7 +529,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_ pr_debug("msk=%p, rm_list_nr=%d\n", msk, rm_list->nr); - if (rm_addr) { + if (mptcp_pm_should_rm_signal(msk)) { MPTCP_ADD_STATS(sock_net((struct sock *)msk), MPTCP_MIB_RMADDRTXDROP, rm_list->nr); return -EINVAL;
-- 2.55.0