From: Paolo Abeni <[email protected]>

The subflow status bitfield is protected by the subflow socket lock,
with one notable exception: the `close_event_done` bit is actually under
the msk socket lock protection.

As reported by Clashiko [1], flipping the latter bit may corrupt other
entries in the same bitfield.

Move the `close_event_done` outside the bitfield, in a 32bit hole.

Link: https://lore.kernel.org/[email protected]
Fixes: d82809b6c5f2 ("mptcp: avoid duplicated SUB_CLOSED events")
Cc: [email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Link: 
https://patch.msgid.link/20261013-net-mptcp-misc-fixes-7-3-rc8-v1-2-932c9b182...@kernel.org
Signed-off-by: Jakub Kicinski <[email protected]>
(cherry picked from commit 7538fa33bb2f66b8b809ff39d58308be48e197a0)

Rebase note: this tree has neither the "closing" nor the "resetting"
subflow flag, nor lent_mem_frag, so __unused grows from 9 to 10 and
close_event_done goes after fully_established.

https://virtuozzo.atlassian.net/browse/VSTOR-154927
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <[email protected]>
---
 net/mptcp/protocol.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index baec108dd7e5..b083ca562c79 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -534,13 +534,15 @@ struct mptcp_subflow_context {
                stale : 1,          /* unable to snd/rcv data, do not use for 
xmit */
                valid_csum_seen : 1,        /* at least one csum validated */
                is_mptfo : 1,       /* subflow is doing TFO */
-               close_event_done : 1,       /* has done the post-closed part */
                mpc_drop : 1,       /* the MPC option has been dropped in a rtx 
*/
-               __unused : 9;
+               __unused : 10;
        bool    data_avail;
        bool    scheduled;
        bool    pm_listener;        /* a listener managed by the kernel PM? */
        bool    fully_established;  /* path validated */
+       bool    close_event_done;   /* has done the post-closed part,
+                                    * protected by msk socket lock
+                                    */
        u32     remote_nonce;
        u64     thmac;
        u32     local_nonce;
-- 
2.56.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to