mptcp: prevent tcp diag from closing listener subflows
authorPaolo Abeni <pabeni@redhat.com>
Tue, 26 Dec 2023 12:10:18 +0000 (13:10 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Jan 2024 00:12:47 +0000 (16:12 -0800)
commit4c0288299fd09ee7c6fbe2f57421f314d8c981db
treec7b846e65031b478531943f31beaf87da87d8aac
parent118ba479d02c5a55e1c1d3c7a43de8937680e67d
mptcp: prevent tcp diag from closing listener subflows

The MPTCP protocol does not expect that any other entity could change
the first subflow status when such socket is listening.
Unfortunately the TCP diag interface allows aborting any TCP socket,
including MPTCP listeners subflows. As reported by syzbot, that trigger
a WARN() and could lead to later bigger trouble.

The MPTCP protocol needs to do some MPTCP-level cleanup actions to
properly shutdown the listener. To keep the fix simple, prevent
entirely the diag interface from stopping such listeners.

We could refine the diag callback in a later, larger patch targeting
net-next.

Fixes: 57fc0f1ceaa4 ("mptcp: ensure listener is unhashed before updating the sk status")
Cc: stable@vger.kernel.org
Reported-by: <syzbot+5a01c3a666e726bc8752@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/netdev/0000000000004f4579060c68431b@google.com/
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20231226-upstream-net-20231226-mptcp-prevent-warn-v1-2-1404dcc431ea@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/subflow.c