From nobody Thu May 16 02:24:10 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 919982E62E for ; Wed, 7 Feb 2024 11:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307011; cv=none; b=PL4JeHhm+RwlHG0hMaKCT4/if63+Oq9P2IooYPXH3C4EEdH6yx9Hy3lwQS4uM9rPJnLVQStaRpw9XH4xXH4b8owYVEeVIiigbkluiEpTy8jO41ejZExr3aoWsMsAjT2GS+hKLWXmYgLzNLC1D9GJd8tW1ghA0B/iqR4lThZl93A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307011; c=relaxed/simple; bh=uCboPJ0LRaDIGMdWuBXqejhsmk8WqCnmSpXCIwZJHFI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uPEMVCqNzmVzBxTdR+2K4HlWg5gIbWtYghR3VRn5V1kSVFPykA06GWLbQrp2c6mz/DPR1AonI36xer84meupdTy3oLKsuRqsMlPcVebgFtWo+/htfpmmx5mQ+FbEMgvTYQNKRBUSyt48LE3qrcG5yR2HvYPVnzXydF23rKhWycI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I9NigX7p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I9NigX7p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67534C433F1; Wed, 7 Feb 2024 11:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707307011; bh=uCboPJ0LRaDIGMdWuBXqejhsmk8WqCnmSpXCIwZJHFI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I9NigX7pty+cIOWakOYSVkUaGuPyB7th8KTx+G7i/qcnBpyu91u3+G7Wu7E8LfAkZ muK7df3+ovTbhHNcJAuRkG43IHIZij1QNYB5aG0LQq1WEnt4334UziREU2XycvEV68 Id/LYl5zIkGMOxV2Xa7QE/Mqo7FMk9THpkKgfh/DZlR3j7YEyNyhRg0UDZV/PMod1x 70JzIFQ6DlZlWnvDQ5PtTgxMsbcjd6u71m0NeYdMWBmiBw3p2dWYlNwvqc/h1gNfeo B+493IufYTao/RNBxTWXZvL//mWzExLHrYu6LmIiLmyLnFLUyYFMtOdLdCES8fwnHI 52al/Q3UgycFg== From: "Matthieu Baerts (NGI0)" Date: Wed, 07 Feb 2024 12:56:23 +0100 Subject: [PATCH mptcp-next v3 1/3] mptcp: token kunit: set protocol Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240207-mptcp-check-protocol-v3-1-77c69c596f55@kernel.org> References: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> In-Reply-To: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> To: mptcp@lists.linux.dev Cc: Paolo Abeni , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1184; i=matttbe@kernel.org; h=from:subject:message-id; bh=uCboPJ0LRaDIGMdWuBXqejhsmk8WqCnmSpXCIwZJHFI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlw3AAxAmfXkhgbYGgQXAFtNJAP+N/0eqM/NL4d 6lb3dPctbGJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZcNwAAAKCRD2t4JPQmmg c7QIEADXU3Qi+G7NfdkMqsO81+hP3yzMbSImJqyIpOZ0+lut2Tq5DPdYj9HXyypWnNGDBo/QDvU ZYqcdQxj5oH2xmbEv702dvXWdFyDyJyDHBR42N6605lcWEL9TVMpLoJ8go7ewzhxKtGGLRTMVTb Fv6TD0UUS5PAmKPHjBNubClMPgOMbh4TGLkJPCJYPfGZwEKekxXI+9XzyXqnUwqHdEzpfgVpwTH iMFZ98852/EhKGUaHIOwgNr0pi4gMbU7fdD8UODTGXJJfa/+8/3dlw4zwklJ+c3xbeYozn9DcZm wKS9G55Ccf820hGDMlNIPOjx45ytq9roD1zFOuzFCY863RrYdHiUx2835/4KcXSsHbgHicUEKV+ 9NicISYTnrRABsR9OOIez1GMRxGtMh4U2cT9IdRMeeqPqmlNHyv2XiQvUJJdb83c4YrFYDHByxm Fnezxa8GNeJCbC+dnPFgqMNi5gj0KYQtaWuYYuSDNxKdPhlrxrs80aGgxgW87ricT5rwgwKonh3 YaIrPwJN0DmsPt11OtCgxHSs4GBU8kK5jxDyo8tdTtCuzqg6oNLtDtlQzafT+DUSEc27m/YOFy9 Rio+v6az03FDD/hKieoc/5GhjFbtww1RMIWqctRZbArQx2WFePvtEJXzX0XbM60emrOdvvjq/FT R1NInt4PoJO7sqg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 As it would be done when initiating an MPTCP sock. This is not strictly needed for this test, but it will be when a later patch will check if the right protocol is being used when calling mptcp_sk(). Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/token_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c index bfff53e668da..4fc39fa2e262 100644 --- a/net/mptcp/token_test.c +++ b/net/mptcp/token_test.c @@ -52,14 +52,19 @@ static struct mptcp_subflow_context *build_ctx(struct k= unit *test) static struct mptcp_sock *build_msk(struct kunit *test) { struct mptcp_sock *msk; + struct sock *sk; =20 msk =3D kunit_kzalloc(test, sizeof(struct mptcp_sock), GFP_USER); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, msk); refcount_set(&((struct sock *)msk)->sk_refcnt, 1); sock_net_set((struct sock *)msk, &init_net); =20 + sk =3D (struct sock *)msk; + /* be sure the token helpers can dereference sk->sk_prot */ - ((struct sock *)msk)->sk_prot =3D &tcp_prot; + sk->sk_prot =3D &tcp_prot; + sk->sk_protocol =3D IPPROTO_MPTCP; + return msk; } =20 --=20 2.43.0 From nobody Thu May 16 02:24:10 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72AA12E856 for ; Wed, 7 Feb 2024 11:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307012; cv=none; b=J1hq9CcffDYuxJv/qG8dOm9OIxjML4exujd7sgIuh5E/yKqXarUCrqy7+XfQcdhCM4JU+JiXK+8WIxYiBX06gcXbfzn/fwnXQupVmkEKoDwZT3RmpX+SLEQ9u/QSBdByFxNvKsLFjBoLmQPoxF6XhIJxhbsp2ZKUR2vw3TK+KMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307012; c=relaxed/simple; bh=4V2mtFiKHeJuBAa3am4+ZUuAoftwJtuommAupSBVqZA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Tnoqtv3LWpMP+qLgMHhOQq14t5A1s59KKdvavU8mES2PPGr/6QffodHoUkJt8mzwYj6cZJqzyOsUDjHCRQEsfdN2ApHwGD5bWZi6F8dtXw6Fh0JPKtQL0f3VC306T/rtUdUcGUrfPVCLLXXY1/Lb8Utcx7oqaiKXCNFe4ewI9F8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QTRdY1yv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QTRdY1yv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F4ECC433C7; Wed, 7 Feb 2024 11:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707307012; bh=4V2mtFiKHeJuBAa3am4+ZUuAoftwJtuommAupSBVqZA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QTRdY1yva1D78y3uudOVEIGTYqYqV8hy30dzS8sZCKJvvr6q1IWL9cUjukPO6HdtS DmmCwXPe5HS0jymmIKKwSqqwkieVSDIYuNJ4TxmC+DBAN60TvF0uVsto8hKpRdJ0BO qLyPnKw98qygGkxP1TYiO15EY4JgMwd6bZHhvg+hbd6vx0kQqF7ZP4mtEi4NMW2eC+ QrNpA9eEe031chC9ZKkkBp5qwz0G6G+ngy4fLmmm9jQDAWfoxw3n/Bu03oErARxSyB X0YVbdzjCC65eyEp2LAy1OYGxtsmv+vgCJwyylVa07ZJQP+pCB1F5coRK4K3YsJetS wGmnCxwef2Prg== From: "Matthieu Baerts (NGI0)" Date: Wed, 07 Feb 2024 12:56:24 +0100 Subject: [PATCH mptcp-next v3 2/3] mptcp: check the protocol in tcp_sk() with DEBUG_NET Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240207-mptcp-check-protocol-v3-2-77c69c596f55@kernel.org> References: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> In-Reply-To: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> To: mptcp@lists.linux.dev Cc: Paolo Abeni , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2060; i=matttbe@kernel.org; h=from:subject:message-id; bh=4V2mtFiKHeJuBAa3am4+ZUuAoftwJtuommAupSBVqZA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlw3AATYqIB3tC+7eqtY2QOfEo9vCtJn4cfrikr ZAVWqLg6k2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZcNwAAAKCRD2t4JPQmmg c6ZiEADmrA41S+EvdQpDHRp+WJBoX03BFRdGQtoez1z2/YGHWMD5+U0qcQxM9yG7gtqkDBb3vDN UZujeVeYvedpJy/mW0rrRqAv59A0dE7hRepIHK5nxX5AcX/++z/nEc8dTst4xgiNqJ6x5w4N8vq DEVJZi/3E8yuR7N0V8PMNUr4BG/eR0C8YANfQmwagMd8THZ8oBCM32YDKOrfy3bxUk/fEncePcZ VWoS45npLEtO1mfrm/JiXUioU0WmXID1v/dgf9gPY3+b16AitJb89w86ZwBHdWqg3pxCWtVT8YV i82csi0N6tCf01jbM0CbxVzWds+gm4YdHrMbwamljl0ceBZrx/Zu0vic0KpBLGVK1z3c8VR/Hed bI6483hYxWR60eyxOfXFWLJeYJaTjPQKGC1t+XRFOr65CLryYjkIsdJmwBemOGKI7wXYww8CVwW J/qZYYuGQ9BR+2XgeFaJP5IzJE2TnkO0UngnZ9FGxnASQEPbKtYamn7COg08YPQzZbL/uOv+Sv+ 3f5Cbuow5y9qKJU9UTF6jV/UVEUVj60GiyZ8q/XYgBWt9YABiNT1dWKItdjKY07K7yYUlK1GBkz TSAnVm+JWzqEXdEYwK3GBnPNdY0awOEEgaZpCz1LTWvAVe10vczyGa3cOvDkJaGNHM6mzh00X87 yB0EjOsYnV3HZ4Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Fuzzers and static checkers might not detect when tcp_sk() is used with a non tcp_sock structure. This kind of mistake already happened a few times with MPTCP: when wrongly using TCP-specific helpers with mptcp_sock pointers. On the other hand, there are many 'tcp_xxx()' helpers that are taking a 'struct sock' pointer as arguments, and some of them are only looking at fields from 'struct sock', and nothing from 'struct tcp_sock'. It is then tempting to use them with a 'struct mptcp_sock'. So a new simple check is done when CONFIG_DEBUG_NET is enabled to tell kernel devs when a non-TCP socket is being used as a TCP one. 'tcp_sk()' macro is then re-defined to add a WARN when an unexpected socket is being used. Signed-off-by: Matthieu Baerts (NGI0) --- Notes: - v2: - Move from include/linux/tcp.h to net/mptcp/protocol.h: specific to TCP (Paolo) - Use a macro instead of an inlined function (Paolo) - Adapt the commit message after the recent changes. - v3: - add parenthesis around 'ptr' (checkpatch) - there is still this check from checkpatch but I guess that's fine: Macro argument reuse 'ptr' - possible side-effects? --- net/mptcp/protocol.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index eefd1397106d..6b62a7f35dd9 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -348,6 +348,15 @@ static inline void msk_owned_by_me(const struct mptcp_= sock *msk) sock_owned_by_me((const struct sock *)msk); } =20 +#ifdef CONFIG_DEBUG_NET +/* MPTCP-specific: we might (indirectly) call this helper with the wrong s= k */ +#undef tcp_sk +#define tcp_sk(ptr) ({ \ + WARN_ON((ptr)->sk_protocol !=3D IPPROTO_TCP); \ + container_of_const(ptr, struct tcp_sock, inet_conn.icsk_inet.sk); \ +}) +#endif + #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_i= net.sk) =20 /* the msk socket don't use the backlog, also account for the bulk --=20 2.43.0 From nobody Thu May 16 02:24:10 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01C76199DC for ; Wed, 7 Feb 2024 11:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307014; cv=none; b=HLdVljYPt9AJy3DhSOlxBXpDcu+q8fzxQoYMpKRFoEjDoqqXkOiAlj8K4NDKbI93qrg6hIpC/jBRcHttAfveFjfc1uvNJj5HePYQkZtVLKBca0+fF1EZLLPZsRGxz+Y25g06ahoJ/8hVxL7X1h3TXeLTfkWksIFL0fN8pwlfrKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307014; c=relaxed/simple; bh=5RnpXBTmJah/lQgyyeXn6rhz8z43A/1TcmH1d3oAxs4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AxSoNiEnmZCWfMUINpohcZsH6fGjvqr7k0Xfh/vUqkPVDuCD+r6Lyy+DjZk5wid06tEfUu8VWPB64Oyexl3KlnCyEHIy4z8QqerVF5gIRdXcXvR7dMo1g5alfu0Q+eQp4mNZToHwwVa5rPEj/AB/dybtkwXjWgKDjcN7fFker9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HbbFhhk5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HbbFhhk5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA4AEC43390; Wed, 7 Feb 2024 11:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707307013; bh=5RnpXBTmJah/lQgyyeXn6rhz8z43A/1TcmH1d3oAxs4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HbbFhhk5mz2hOoMI72eWebhYndAjJY7loZk4YuIOYQZLo4W7FmsouR8ImbSuC2hoo aqkvr6BW803H9wS1t4Uer0FipSHdJLc90SJQTAFjE/vgifSkFyel++whDADmdMxPL6 k6bP1RwFtOp5MByyPLn3OM0yqy73FxUNZVyLQh0Wsz3aiC4Ps/R1icgNxLy/HFA92D BnlI/p+5MHn3WhZ7Mj5xYxyAXjp+7J4MKbBeLdTkTDiGHwX6olxIQcvgKNyIQX8LHp 3m67CIhObah/Wo4SOVsmyAFIQnhB9n4JUgB8Q3DCyiyVn3bIpXSMnxOKinZq0J/BOZ OIqMRQ6nsq+7g== From: "Matthieu Baerts (NGI0)" Date: Wed, 07 Feb 2024 12:56:25 +0100 Subject: [PATCH mptcp-next v3 3/3] mptcp: check the protocol in mptcp_sk() with DEBUG_NET Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240207-mptcp-check-protocol-v3-3-77c69c596f55@kernel.org> References: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> In-Reply-To: <20240207-mptcp-check-protocol-v3-0-77c69c596f55@kernel.org> To: mptcp@lists.linux.dev Cc: Paolo Abeni , "Matthieu Baerts (NGI0)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1675; i=matttbe@kernel.org; h=from:subject:message-id; bh=5RnpXBTmJah/lQgyyeXn6rhz8z43A/1TcmH1d3oAxs4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlw3AAQn1XmhWjaQG6CvjdZmUCDOZNz2u02nBwh Lv6ycjTirmJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZcNwAAAKCRD2t4JPQmmg c8YhEACgks0ptmmkAev8mOdVc7YdlWPOZ0c2emM6NZKsMuQE/1lxo+kQVQBf/NExZHhbj/KA7qi YW5QBNk05G2u+peBF+AnqbsrYPLGNAmB/mVx+mTk/Qn3hgH0q0o6UiMjQZkiT5oEa5SjO0RLT95 7HtPqze9i3kknBDKspYcoqx6xoAK30gc0pJE0M3q+7uQUxuEDeZFQCd5gutPYmSfo2S4hGcnVrk z6plHRoz7O0add87rPU8WN42Bs2mE3KISWibciKMfq15M0GV3m5jztQeCbOUoDlBV/zzUviBEh0 5+MluqAezWUBD3PWBkH65jPJZgmkcCNH6hV4CXlH0kjG22Gr6QRbI59F3Kbnygrv83ImWgBC6EJ 3RMIOLEIpQOSCaKFgVokiNbvIZpIdtjVkDRABMHx2ktvDxz8JkQpaW8Lsmom/aRDmTNXSfSd2eJ yP4H7MkTjuIkIWhzfNGK3M+NXEFOOE7npIcTawv8NPYWT7grWzPB8BH3TSOUdVBsai/1tHLoEe2 tuweMIMlZdGSZA6tPxBa3EXeD1DdBbDvXjnWez/Q5aApQJUamHzjAcRNty1J90dMKgbnnIvwbtM Qd0zTrXTskTWVphwJYtVO1ZgGBviWbnykPMYwe5Jk+vW3Yb6Q0znT/ZnyKHFkjHTXePQI//x9Lf dISiyBtdcWVWrVg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 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. Signed-off-by: Matthieu Baerts (NGI0) --- Notes: v2: - Use a macro instead of an inlined function (Paolo) v3: - add parenthesis around 'ptr' (checkpatch) - there is still this check from checkpatch but I guess that's fine: Macro argument reuse 'ptr' - possible side-effects? --- net/mptcp/protocol.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 6b62a7f35dd9..2b837676d1fc 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -355,9 +355,14 @@ static inline void msk_owned_by_me(const struct mptcp_= sock *msk) WARN_ON((ptr)->sk_protocol !=3D IPPROTO_TCP); \ container_of_const(ptr, struct tcp_sock, inet_conn.icsk_inet.sk); \ }) -#endif +#define mptcp_sk(ptr) ({ \ + WARN_ON((ptr)->sk_protocol !=3D IPPROTO_MPTCP); \ + container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk); \ +}) =20 +#else /* !CONFIG_DEBUG_NET */ #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_i= net.sk) +#endif =20 /* the msk socket don't use the backlog, also account for the bulk * free memory --=20 2.43.0