Patch "mptcp: do not rely on implicit state check in mptcp_listen()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mptcp: do not rely on implicit state check in mptcp_listen()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mptcp-do-not-rely-on-implicit-state-check-in-mptcp_l.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 07ac84cfbb62721380cca3bd9b5be0c4281e59ce
Author: Paolo Abeni <pabeni@xxxxxxxxxx>
Date:   Tue Jul 4 22:44:34 2023 +0200

    mptcp: do not rely on implicit state check in mptcp_listen()
    
    [ Upstream commit 0226436acf2495cde4b93e7400e5a87305c26054 ]
    
    Since the blamed commit, closing the first subflow resets the first
    subflow socket state to SS_UNCONNECTED.
    
    The current mptcp listen implementation relies only on such
    state to prevent touching not-fully-disconnected sockets.
    
    Incoming mptcp fastclose (or paired endpoint removal) unconditionally
    closes the first subflow.
    
    All the above allows an incoming fastclose followed by a listen() call
    to successfully race with a blocking recvmsg(), potentially causing the
    latter to hit a divide by zero bug in cleanup_rbuf/__tcp_select_window().
    
    Address the issue explicitly checking the msk socket state in
    mptcp_listen(). An alternative solution would be moving the first
    subflow socket state update into mptcp_disconnect(), but in the long
    term the first subflow socket should be removed: better avoid relaying
    on it for internal consistency check.
    
    Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation")
    Cc: stable@xxxxxxxxxxxxxxx
    Reported-by: Christoph Paasch <cpaasch@xxxxxxxxx>
    Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/414
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Reviewed-by: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>
    Signed-off-by: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 208da9a9909c2..37ff6766fd526 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3753,6 +3753,11 @@ static int mptcp_listen(struct socket *sock, int backlog)
 	pr_debug("msk=%p", msk);
 
 	lock_sock(sk);
+
+	err = -EINVAL;
+	if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM)
+		goto unlock;
+
 	ssock = __mptcp_nmpc_socket(msk);
 	if (!ssock) {
 		err = -EINVAL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux