mptcp: fix locking for setsockopt corner-case
authorPaolo Abeni <pabeni@redhat.com>
Tue, 7 Feb 2023 13:04:14 +0000 (14:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:59:40 +0000 (12:59 +0100)
commit03edc4a27dad21f787ce294c23786858b83b34a3
tree5ad7f52483398e23dbe13c8aa893ef41ee7d8a18
parent94ed108bf18cb045a40a42661c093a579770c831
mptcp: fix locking for setsockopt corner-case

[ Upstream commit 21e43569685de4ad773fb060c11a15f3fd5e7ac4 ]

We need to call the __mptcp_nmpc_socket(), and later subflow socket
access under the msk socket lock, or e.g. a racing connect() could
change the socket status under the hood, with unexpected results.

Fixes: 54635bd04701 ("mptcp: add TCP_FASTOPEN_CONNECT socket option")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mptcp/sockopt.c