kernel_optimize_test/net/mptcp
Florian Westphal 451f1eded7 mptcp: clear 'kern' flag from fallback sockets
[ Upstream commit d6692b3b97bdc165d150f4c1505751a323a80717 ]

The mptcp ULP extension relies on sk->sk_sock_kern being set correctly:
It prevents setsockopt(fd, IPPROTO_TCP, TCP_ULP, "mptcp", 6); from
working for plain tcp sockets (any userspace-exposed socket).

But in case of fallback, accept() can return a plain tcp sk.
In such case, sk is still tagged as 'kernel' and setsockopt will work.

This will crash the kernel, The subflow extension has a NULL ctx->conn
mptcp socket:

BUG: KASAN: null-ptr-deref in subflow_data_ready+0x181/0x2b0
Call Trace:
 tcp_data_ready+0xf8/0x370
 [..]

Fixes: cf7da0d66c ("mptcp: Create SUBFLOW socket for incoming connections")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-22 09:30:54 +01:00
..
crypto_test.c
crypto.c
ctrl.c
diag.c
Kconfig mptcp: depends on IPV6 but not as a module 2020-10-21 08:05:40 -07:00
Makefile
mib.c mptcp: print new line in mptcp_seq_show() if mptcp isn't in use 2020-12-07 17:45:29 -08:00
mib.h
mptcp_diag.c mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00
options.c mptcp: fix delack timer 2021-12-01 09:19:04 +01:00
pm_netlink.c mptcp: Constify mptcp_pm_ops 2020-10-04 21:13:36 -07:00
pm.c
protocol.c mptcp: clear 'kern' flag from fallback sockets 2021-12-22 09:30:54 +01:00
protocol.h mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00
subflow.c mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00
syncookies.c mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00
token_test.c mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00
token.c mptcp: don't return sockets in foreign netns 2021-10-06 15:55:52 +02:00