Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216437/?format=api
{ "id": 2216437, "url": "http://patchwork.ozlabs.org/api/patches/2216437/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260326125153.685915-10-pablo@netfilter.org/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/projects/26/?format=api", "name": "Netfilter Development", "link_name": "netfilter-devel", "list_id": "netfilter-devel.vger.kernel.org", "list_email": "netfilter-devel@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260326125153.685915-10-pablo@netfilter.org>", "list_archive_url": null, "date": "2026-03-26T12:51:50", "name": "[net,09/12] netfilter: nf_conntrack_expect: store netns and zone in expectation", "commit_ref": null, "pull_url": null, "state": "handled-elsewhere", "archived": true, "hash": "2f5df89cb364d8ff1f541c4ba5ea64e82d7bad83", "submitter": { "id": 1315, "url": "http://patchwork.ozlabs.org/api/people/1315/?format=api", "name": "Pablo Neira Ayuso", "email": "pablo@netfilter.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260326125153.685915-10-pablo@netfilter.org/mbox/", "series": [ { "id": 497584, "url": "http://patchwork.ozlabs.org/api/series/497584/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=497584", "date": "2026-03-26T12:51:41", "name": "[net,01/12] netfilter: nft_set_pipapo_avx2: don't return non-matching entry on expiry", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/497584/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216437/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216437/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-11448-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "netfilter-devel@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=netfilter.org header.i=@netfilter.org\n header.a=rsa-sha256 header.s=2025 header.b=cFmBQh20;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11448-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=\"cFmBQh20\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.70.190.124", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=netfilter.org" ], "Received": [ "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhNxN1CFVz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 23:53:28 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 2BA893027EC3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 12:52:27 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2476A298CAF;\n\tThu, 26 Mar 2026 12:52:14 +0000 (UTC)", "from mail.netfilter.org (mail.netfilter.org [217.70.190.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 54379248861;\n\tThu, 26 Mar 2026 12:52:10 +0000 (UTC)", "from localhost.localdomain (mail-agni [217.70.190.124])\n\tby mail.netfilter.org (Postfix) with ESMTPSA id 2D64660272;\n\tThu, 26 Mar 2026 13:52:08 +0100 (CET)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774529533; cv=none;\n b=TCaQgtu7Xq+WbEEd9GXf/A0Ade07MDZGlTY0w6qGvG73o+AHaDPQoocpKcgIX/I/3Kr17IkJ+mBMFMWwlmRvkPWexB/ZrZGmjMyCVinPW8R0M92K51bCzcaFZiP8WBKDph8oiAXncR7QO7SGaYgZpqg59qnQ1wbBzHuM66mxuzc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774529533; c=relaxed/simple;\n\tbh=gztqscbUaLD/2uRGb0cq135ZPkvkaCUcDDpyOb7ibUs=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=LOj7IWyeh2h2zPw+8kEKRgJNynTMoW1uZzY9oXdxyuB5FDS/BRg7T8h63W4pbSBn8WS73ywO8yzpolGgFpv4vdK3/A3zcyU5XNWUs6SCorKy5/Qv4BUK2xM9ev5ic46z9n2Qo/MOdCSTgsoP0GryxE31R59X+8ijp/601Xr8aBw=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org;\n spf=pass smtp.mailfrom=netfilter.org;\n dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=cFmBQh20; arc=none smtp.client-ip=217.70.190.124", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org;\n\ts=2025; t=1774529528;\n\tbh=BhmEnl0LM1sg6QQoh5cz1f0Q9H6mjqbhLb5C6npbmUw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cFmBQh20U/ccFahbJj5AWf6V/VcRCXmMgNluks10T6tPObvb/X0ldrirxHvivqWS1\n\t 0cZZxYQwMAUvvX22bLwvjTHB+6rP7feIWeEGGd9g6Ha70qsOcAurhX0kgSTzjtFJLH\n\t Z2mXxVquXYy9+C09tbQRiIiWMfvwsI01QIgC1P9R8U3l7ft0dnYkwmjQgPLR5xhU+t\n\t sMuvHyymPYrOXNDlaAZxu7/9kjcB73y93QDIEQLOO37z6YotNwsaBIhA6V5yWWgpVQ\n\t l3URevPpymCSiSBTCYEWha2nYg/R7zf2tn4M5KfQlBqRA2mfxbi+XScfbcQ1KcxVh+\n\t 4QdQmUJRYQlNg==", "From": "Pablo Neira Ayuso <pablo@netfilter.org>", "To": "netfilter-devel@vger.kernel.org", "Cc": "davem@davemloft.net,\n\tnetdev@vger.kernel.org,\n\tkuba@kernel.org,\n\tpabeni@redhat.com,\n\tedumazet@google.com,\n\tfw@strlen.de,\n\thorms@kernel.org", "Subject": "[PATCH net 09/12] netfilter: nf_conntrack_expect: store netns and\n zone in expectation", "Date": "Thu, 26 Mar 2026 13:51:50 +0100", "Message-ID": "<20260326125153.685915-10-pablo@netfilter.org>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260326125153.685915-1-pablo@netfilter.org>", "References": "<20260326125153.685915-1-pablo@netfilter.org>", "Precedence": "bulk", "X-Mailing-List": "netfilter-devel@vger.kernel.org", "List-Id": "<netfilter-devel.vger.kernel.org>", "List-Subscribe": "<mailto:netfilter-devel+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:netfilter-devel+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "__nf_ct_expect_find() and nf_ct_expect_find_get() are called under\nrcu_read_lock() but they dereference the master conntrack via\nexp->master.\n\nSince the expectation does not hold a reference on the master conntrack,\nthis could be dying conntrack or different recycled conntrack than the\nreal master due to SLAB_TYPESAFE_RCU.\n\nStore the netns, the master_tuple and the zone in struct\nnf_conntrack_expect as a safety measure.\n\nThis patch is required by the follow up fix not to dump expectations\nthat do not belong to this netns.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n include/net/netfilter/nf_conntrack_expect.h | 18 +++++++++++++++++-\n net/netfilter/nf_conntrack_broadcast.c | 6 +++++-\n net/netfilter/nf_conntrack_expect.c | 9 +++++++--\n net/netfilter/nf_conntrack_netlink.c | 5 +++++\n 4 files changed, 34 insertions(+), 4 deletions(-)", "diff": "diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h\nindex 1b01400b10bd..e9a8350e7ccf 100644\n--- a/include/net/netfilter/nf_conntrack_expect.h\n+++ b/include/net/netfilter/nf_conntrack_expect.h\n@@ -22,10 +22,16 @@ struct nf_conntrack_expect {\n \t/* Hash member */\n \tstruct hlist_node hnode;\n \n+\t/* Network namespace */\n+\tpossible_net_t net;\n+\n \t/* We expect this tuple, with the following mask */\n \tstruct nf_conntrack_tuple tuple;\n \tstruct nf_conntrack_tuple_mask mask;\n \n+#ifdef CONFIG_NF_CONNTRACK_ZONES\n+\tstruct nf_conntrack_zone zone;\n+#endif\n \t/* Usage count. */\n \trefcount_t use;\n \n@@ -62,7 +68,17 @@ struct nf_conntrack_expect {\n \n static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)\n {\n-\treturn nf_ct_net(exp->master);\n+\treturn read_pnet(&exp->net);\n+}\n+\n+static inline bool nf_ct_exp_zone_equal_any(const struct nf_conntrack_expect *a,\n+\t\t\t\t\t const struct nf_conntrack_zone *b)\n+{\n+#ifdef CONFIG_NF_CONNTRACK_ZONES\n+\treturn a->zone.id == b->id;\n+#else\n+\treturn true;\n+#endif\n }\n \n #define NF_CT_EXP_POLICY_NAME_LEN\t16\ndiff --git a/net/netfilter/nf_conntrack_broadcast.c b/net/netfilter/nf_conntrack_broadcast.c\nindex 1964c596c646..4f39bf7c843f 100644\n--- a/net/netfilter/nf_conntrack_broadcast.c\n+++ b/net/netfilter/nf_conntrack_broadcast.c\n@@ -21,6 +21,7 @@ int nf_conntrack_broadcast_help(struct sk_buff *skb,\n \t\t\t\tunsigned int timeout)\n {\n \tconst struct nf_conntrack_helper *helper;\n+\tstruct net *net = read_pnet(&ct->ct_net);\n \tstruct nf_conntrack_expect *exp;\n \tstruct iphdr *iph = ip_hdr(skb);\n \tstruct rtable *rt = skb_rtable(skb);\n@@ -71,7 +72,10 @@ int nf_conntrack_broadcast_help(struct sk_buff *skb,\n \texp->flags = NF_CT_EXPECT_PERMANENT;\n \texp->class\t\t = NF_CT_EXPECT_CLASS_DEFAULT;\n \trcu_assign_pointer(exp->helper, helper);\n-\n+\twrite_pnet(&exp->net, net);\n+#ifdef CONFIG_NF_CONNTRACK_ZONES\n+\texp->zone = ct->zone;\n+#endif\n \tnf_ct_expect_related(exp, 0);\n \tnf_ct_expect_put(exp);\n \ndiff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c\nindex 1cbe5f1108c2..db28801b1688 100644\n--- a/net/netfilter/nf_conntrack_expect.c\n+++ b/net/netfilter/nf_conntrack_expect.c\n@@ -113,8 +113,8 @@ nf_ct_exp_equal(const struct nf_conntrack_tuple *tuple,\n \t\tconst struct net *net)\n {\n \treturn nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask) &&\n-\t net_eq(net, nf_ct_net(i->master)) &&\n-\t nf_ct_zone_equal_any(i->master, zone);\n+\t net_eq(net, read_pnet(&i->net)) &&\n+\t nf_ct_exp_zone_equal_any(i, zone);\n }\n \n bool nf_ct_remove_expect(struct nf_conntrack_expect *exp)\n@@ -326,6 +326,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,\n {\n \tstruct nf_conntrack_helper *helper = NULL;\n \tstruct nf_conn *ct = exp->master;\n+\tstruct net *net = read_pnet(&ct->ct_net);\n \tstruct nf_conn_help *help;\n \tint len;\n \n@@ -343,6 +344,10 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, unsigned int class,\n \t\thelper = rcu_dereference(help->helper);\n \n \trcu_assign_pointer(exp->helper, helper);\n+\twrite_pnet(&exp->net, net);\n+#ifdef CONFIG_NF_CONNTRACK_ZONES\n+\texp->zone = ct->zone;\n+#endif\n \texp->tuple.src.l3num = family;\n \texp->tuple.dst.protonum = proto;\n \ndiff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c\nindex 89540112d165..6e6aeb0ab0a1 100644\n--- a/net/netfilter/nf_conntrack_netlink.c\n+++ b/net/netfilter/nf_conntrack_netlink.c\n@@ -3538,6 +3538,7 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct,\n \t\t struct nf_conntrack_tuple *tuple,\n \t\t struct nf_conntrack_tuple *mask)\n {\n+\tstruct net *net = read_pnet(&ct->ct_net);\n \tstruct nf_conntrack_expect *exp;\n \tstruct nf_conn_help *help;\n \tu32 class = 0;\n@@ -3577,6 +3578,10 @@ ctnetlink_alloc_expect(const struct nlattr * const cda[], struct nf_conn *ct,\n \n \texp->class = class;\n \texp->master = ct;\n+\twrite_pnet(&exp->net, net);\n+#ifdef CONFIG_NF_CONNTRACK_ZONES\n+\texp->zone = ct->zone;\n+#endif\n \tif (!helper)\n \t\thelper = rcu_dereference(help->helper);\n \trcu_assign_pointer(exp->helper, helper);\n", "prefixes": [ "net", "09/12" ] }