Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2232018/?format=api
{ "id": 2232018, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2232018/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260502075639.7440-6-fw@strlen.de/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260502075639.7440-6-fw@strlen.de>", "list_archive_url": null, "date": "2026-05-02T07:56:39", "name": "[nf,5/5] netfilter: ebtables: move to two-stage removal scheme", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "159239e3e1b76185d17044f3d5d9f40e9e092a92", "submitter": { "id": 1025, "url": "http://patchwork.ozlabs.org/api/1.2/people/1025/?format=api", "name": "Florian Westphal", "email": "fw@strlen.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260502075639.7440-6-fw@strlen.de/mbox/", "series": [ { "id": 502515, "url": "http://patchwork.ozlabs.org/api/1.2/series/502515/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=502515", "date": "2026-05-02T07:56:34", "name": "netfilter: xtables: fix module unload and teardown races", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502515/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2232018/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2232018/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-12394-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 spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12394-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.216.245.30", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g70cZ11zmz1yJ0\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 17:57:18 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id CECAC3020029\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 2 May 2026 07:57:10 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 34B09305968;\n\tSat, 2 May 2026 07:57:10 +0000 (UTC)", "from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc\n [91.216.245.30])\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 9BBFA2FF170\n\tfor <netfilter-devel@vger.kernel.org>; Sat, 2 May 2026 07:57:08 +0000 (UTC)", "by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 68BF1606C8; Sat, 02 May 2026 09:57:07 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777708629; cv=none;\n b=jeBKbwJhZU0TnU7AyaYiwimI+9AJT5qEDdWXsJdxvRVMQwE8qf1SMC5Cy3+td7HQbnmxEgDv9LjlkYuve+lMFgELXgQa/yt/ztH0OZb851nHsbV0DlikiNQ1aQ/NFb3LaQlE+UyONYLJ6WdwH+cLEdCRcEEfursnoNY3QfUYFPU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777708629; c=relaxed/simple;\n\tbh=NOR1/DCgSrjE4nlSw6BupEp/jGZ0xooUz/okRPeY3l4=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=EDPZJ4ffTzpEph3BiO02quhvXiN1AWGPxXMyfnWY6QTLMA1urHOESqkFXlndTpLX+TAx149BXA4TKxILY9/qiuAsmHLRDQW/kA9XkGS8gBCgWAAMzM/FVpSjfNBAdheOBZmT1nHRrQR24fxFYiIpvKkeWyzPlzP7b60B58LIra8=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc;\n arc=none smtp.client-ip=91.216.245.30", "From": "Florian Westphal <fw@strlen.de>", "To": "<netfilter-devel@vger.kernel.org>", "Cc": "tristan@talencesecurity.com,\n\tFlorian Westphal <fw@strlen.de>", "Subject": "[PATCH nf 5/5] netfilter: ebtables: move to two-stage removal scheme", "Date": "Sat, 2 May 2026 09:56:39 +0200", "Message-ID": "<20260502075639.7440-6-fw@strlen.de>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260502075639.7440-1-fw@strlen.de>", "References": "<20260502075639.7440-1-fw@strlen.de>", "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": "Like previous patches for x_tables, follow same pattern in ebtables.\nWe can't reuse xt helpers: ebt_table struct layout is incompatible.\n\ntable->ops assignment is now done while still holding the ebt mutex\nto make sure we never expose partially-filled table struct.\n\nFixes: 87663c39f898 (\"netfilter: ebtables: do not hook tables by default\")\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/bridge/netfilter/ebtable_broute.c | 2 +-\n net/bridge/netfilter/ebtable_nat.c | 2 +-\n net/bridge/netfilter/ebtables.c | 52 ++++++++++++++++-----------\n 3 files changed, 34 insertions(+), 22 deletions(-)", "diff": "diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c\nindex 741360219552..e6f9e343b41f 100644\n--- a/net/bridge/netfilter/ebtable_broute.c\n+++ b/net/bridge/netfilter/ebtable_broute.c\n@@ -128,8 +128,8 @@ static int __init ebtable_broute_init(void)\n \n static void __exit ebtable_broute_fini(void)\n {\n-\tunregister_pernet_subsys(&broute_net_ops);\n \tebt_unregister_template(&broute_table);\n+\tunregister_pernet_subsys(&broute_net_ops);\n }\n \n module_init(ebtable_broute_init);\ndiff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c\nindex 0f2a8c6118d4..9985a82555c4 100644\n--- a/net/bridge/netfilter/ebtable_nat.c\n+++ b/net/bridge/netfilter/ebtable_nat.c\n@@ -109,8 +109,8 @@ static int __init ebtable_nat_init(void)\n \n static void __exit ebtable_nat_fini(void)\n {\n-\tunregister_pernet_subsys(&frame_nat_net_ops);\n \tebt_unregister_template(&frame_nat);\n+\tunregister_pernet_subsys(&frame_nat_net_ops);\n }\n \n module_init(ebtable_nat_init);\ndiff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c\nindex aea3e19875c6..546dbae1c659 100644\n--- a/net/bridge/netfilter/ebtables.c\n+++ b/net/bridge/netfilter/ebtables.c\n@@ -42,6 +42,7 @@\n \n struct ebt_pernet {\n \tstruct list_head tables;\n+\tstruct list_head dead_tables;\n };\n \n struct ebt_template {\n@@ -1162,9 +1163,6 @@ static int do_replace(struct net *net, sockptr_t arg, unsigned int len)\n \n static void __ebt_unregister_table(struct net *net, struct ebt_table *table)\n {\n-\tmutex_lock(&ebt_mutex);\n-\tlist_del(&table->list);\n-\tmutex_unlock(&ebt_mutex);\n \taudit_log_nfcfg(table->name, AF_BRIDGE, table->private->nentries,\n \t\t\tAUDIT_XT_OP_UNREGISTER, GFP_KERNEL);\n \tEBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size,\n@@ -1267,13 +1265,13 @@ int ebt_register_table(struct net *net, const struct ebt_table *input_table,\n \tfor (i = 0; i < num_ops; i++)\n \t\tops[i].priv = table;\n \n-\tlist_add(&table->list, &ebt_net->tables);\n-\tmutex_unlock(&ebt_mutex);\n-\n \ttable->ops = ops;\n \tret = nf_register_net_hooks(net, ops, num_ops);\n \tif (ret)\n \t\t__ebt_unregister_table(net, table);\n+\telse\n+\t\tlist_add(&table->list, &ebt_net->tables);\n+\tmutex_unlock(&ebt_mutex);\n \n \taudit_log_nfcfg(repl->name, AF_BRIDGE, repl->nentries,\n \t\t\tAUDIT_XT_OP_REGISTER, GFP_KERNEL);\n@@ -1339,7 +1337,7 @@ void ebt_unregister_template(const struct ebt_table *t)\n }\n EXPORT_SYMBOL(ebt_unregister_template);\n \n-static struct ebt_table *__ebt_find_table(struct net *net, const char *name)\n+void ebt_unregister_table_pre_exit(struct net *net, const char *name)\n {\n \tstruct ebt_pernet *ebt_net = net_generic(net, ebt_pernet_id);\n \tstruct ebt_table *t;\n@@ -1348,30 +1346,34 @@ static struct ebt_table *__ebt_find_table(struct net *net, const char *name)\n \n \tlist_for_each_entry(t, &ebt_net->tables, list) {\n \t\tif (strcmp(t->name, name) == 0) {\n+\t\t\tlist_move(&t->list, &ebt_net->dead_tables);\n \t\t\tmutex_unlock(&ebt_mutex);\n-\t\t\treturn t;\n+\t\t\tnf_unregister_net_hooks(net, t->ops, hweight32(t->valid_hooks));\n+\t\t\treturn;\n \t\t}\n \t}\n \n \tmutex_unlock(&ebt_mutex);\n-\treturn NULL;\n-}\n-\n-void ebt_unregister_table_pre_exit(struct net *net, const char *name)\n-{\n-\tstruct ebt_table *table = __ebt_find_table(net, name);\n-\n-\tif (table)\n-\t\tnf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks));\n }\n EXPORT_SYMBOL(ebt_unregister_table_pre_exit);\n \n void ebt_unregister_table(struct net *net, const char *name)\n {\n-\tstruct ebt_table *table = __ebt_find_table(net, name);\n+\tstruct ebt_pernet *ebt_net = net_generic(net, ebt_pernet_id);\n+\tstruct ebt_table *t;\n \n-\tif (table)\n-\t\t__ebt_unregister_table(net, table);\n+\tmutex_lock(&ebt_mutex);\n+\n+\tlist_for_each_entry(t, &ebt_net->dead_tables, list) {\n+\t\tif (strcmp(t->name, name) == 0) {\n+\t\t\tlist_del(&t->list);\n+\t\t\t__ebt_unregister_table(net, t);\n+\t\t\tmutex_unlock(&ebt_mutex);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\n+\tmutex_unlock(&ebt_mutex);\n }\n \n /* userspace just supplied us with counters */\n@@ -2556,11 +2558,21 @@ static int __net_init ebt_pernet_init(struct net *net)\n \tstruct ebt_pernet *ebt_net = net_generic(net, ebt_pernet_id);\n \n \tINIT_LIST_HEAD(&ebt_net->tables);\n+\tINIT_LIST_HEAD(&ebt_net->dead_tables);\n \treturn 0;\n }\n \n+static void __net_exit ebt_pernet_exit(struct net *net)\n+{\n+\tstruct ebt_pernet *ebt_net = net_generic(net, ebt_pernet_id);\n+\n+\tWARN_ON_ONCE(!list_empty(&ebt_net->tables));\n+\tWARN_ON_ONCE(!list_empty(&ebt_net->dead_tables));\n+}\n+\n static struct pernet_operations ebt_net_ops = {\n \t.init = ebt_pernet_init,\n+\t.exit = ebt_pernet_exit,\n \t.id = &ebt_pernet_id,\n \t.size = sizeof(struct ebt_pernet),\n };\n", "prefixes": [ "nf", "5/5" ] }