]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mptcp: bpf: Fix type confusion in bpf_mptcp_sock_from_subflow()
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Mon, 4 May 2026 21:04:50 +0000 (21:04 +0000)
committerMartin KaFai Lau <martin.lau@kernel.org>
Fri, 8 May 2026 18:38:10 +0000 (11:38 -0700)
commit7995b216a731db657f356f6ae37a42f445b9a0ec
treeebb6f27d4ada3382130d60caa56c74b206cf7f9e
parentd73549b8bb7fa6147666c579d66f72bf076f719f
mptcp: bpf: Fix type confusion in bpf_mptcp_sock_from_subflow()

bpf_mptcp_sock_from_subflow() only checks if sk->sk_protocol is
IPPROTO_TCP, but RAW socket can bypass it:

  socket(AF_INET, SOCK_RAW, IPPROTO_TCP)

In this case, it would NOT be valid to call sk_is_mptcp() which will
assume sk is a pointer to a struct tcp_sock, and wrongly checks for:
tcp_sk(sk)->is_mptcp.

Fixes: 3bc253c2e652 ("bpf: Add bpf_skc_to_mptcp_sock_proto")
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260504210610.180150-4-kuniyu@google.com
net/mptcp/bpf.c