]> www.infradead.org Git - users/dwmw2/linux.git/commit
mptcp: check the protocol in mptcp_sk() with DEBUG_NET
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Fri, 23 Feb 2024 20:17:56 +0000 (21:17 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 27 Feb 2024 02:42:12 +0000 (18:42 -0800)
commit14d29ec5302caac945267b9586fad01ecddc700c
tree9808e30ca708893e9dae19499c91e9b5133cdc4f
parentdcc03f270d1e2f4b9715537d8deb734bd019e187
mptcp: check the protocol in mptcp_sk() with DEBUG_NET

Fuzzers and static checkers might not detect when mptcp_sk() is used
with a non mptcp_sock structure.

This is similar to the parent commit, where it is easy to use mptcp_sk()
with a TCP sock, e.g. with a subflow sk.

So a new simple check is done when CONFIG_DEBUG_NET is enabled to tell
kernel devs when a non-MPTCP socket is being used as an MPTCP one.
'mptcp_sk()' macro is then defined differently: with an extra WARN to
complain when an unexpected socket is being used.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240223-upstream-net-next-20240223-misc-improvements-v1-4-b6c8a10396bd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/protocol.h