get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2215867/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2215867,
    "url": "http://patchwork.ozlabs.org/api/patches/2215867/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260325131108.23045-6-fw@strlen.de/",
    "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": "<20260325131108.23045-6-fw@strlen.de>",
    "list_archive_url": null,
    "date": "2026-03-25T13:10:59",
    "name": "[net,05/14] netfilter: x_tables: reject unsupported families in xt_check_match/xt_check_target",
    "commit_ref": null,
    "pull_url": null,
    "state": "handled-elsewhere",
    "archived": true,
    "hash": "9156e64550e6c2e8c4e03c6bcbeb2683a9f46567",
    "submitter": {
        "id": 1025,
        "url": "http://patchwork.ozlabs.org/api/people/1025/?format=api",
        "name": "Florian Westphal",
        "email": "fw@strlen.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260325131108.23045-6-fw@strlen.de/mbox/",
    "series": [
        {
            "id": 497441,
            "url": "http://patchwork.ozlabs.org/api/series/497441/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=497441",
            "date": "2026-03-25T13:10:55",
            "name": "[net,01/14] netfilter: nft_set_pipapo_avx2: don't return non-matching entry on expiry",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497441/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2215867/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2215867/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <netfilter-devel+bounces-11399-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:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11399-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 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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgp5k09B7z1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 00:43:38 +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 25210318072A\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 13:12:48 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 13EFA3DB63C;\n\tWed, 25 Mar 2026 13:11:58 +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 7804C3D8126;\n\tWed, 25 Mar 2026 13:11:56 +0000 (UTC)",
            "by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 203AC6080C; Wed, 25 Mar 2026 14:11:55 +0100 (CET)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774444317; cv=none;\n b=aKzbUgagrrQtppYHgjkl3J25y9+RFQ+ec4VxKJEWjvSXN6WvnfWL64Ugo+el96XwgeUcAY0gru1wtrF1VbFIezxb1CF4gvln0op6Ev95EmEnVEkYbZMzhlFJ5but+VWu0ngYIPVR1gLAGZBMS2F9bjAFpUDLWDS4/Zlm9LRWNIQ=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774444317; c=relaxed/simple;\n\tbh=5QITqE8OG+JZWtv3BHu5U8D15SKXdtcnQrydzQ0OL54=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=h0AREpfqpETM4+1kbL+Vbkh6akSa74RoQ+C7pnk0rwq7imZAGCpB9FxIT2Jm6kxbQ0sTDJGaJUgT7EhJGJtwRR+NYET8lc6ys+m8fPwzfYVeCU5r8k8pVnVyX7HYgB3kPvpZz0jyFVjfvjJ+dICZMv3VImwZV3tFdIvGNLIIyMo=",
        "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": "<netdev@vger.kernel.org>",
        "Cc": "Paolo Abeni <pabeni@redhat.com>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tEric Dumazet <edumazet@google.com>,\n\tJakub Kicinski <kuba@kernel.org>,\n\t<netfilter-devel@vger.kernel.org>,\n\tpablo@netfilter.org",
        "Subject": "[PATCH net 05/14] netfilter: x_tables: reject unsupported families in\n xt_check_match/xt_check_target",
        "Date": "Wed, 25 Mar 2026 14:10:59 +0100",
        "Message-ID": "<20260325131108.23045-6-fw@strlen.de>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260325131108.23045-1-fw@strlen.de>",
        "References": "<20260325131108.23045-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": "From: Weiming Shi <bestswngs@gmail.com>\n\nxt_match and xt_target structs registered with NFPROTO_UNSPEC can be\nloaded by any protocol family through nft_compat. When such a\nmatch/target sets .hooks to restrict which hooks it may run on, the\nbitmask uses NF_INET_* constants. This is only correct for families\nwhose hook layout matches NF_INET_*: IPv4, IPv6, INET, and bridge\nall share the same five hooks (PRE_ROUTING ... POST_ROUTING).\n\nARP only has three hooks (IN=0, OUT=1, FORWARD=2) with different\nsemantics. Because NF_ARP_OUT == 1 == NF_INET_LOCAL_IN, the .hooks\nvalidation silently passes for the wrong reasons, allowing matches to\nrun on ARP chains where the hook assumptions (e.g. state->in being\nset on input hooks) do not hold. This leads to NULL pointer\ndereferences; xt_devgroup is one concrete example:\n\n Oops: general protection fault, probably for non-canonical address 0xdffffc0000000044: 0000 [#1] SMP KASAN NOPTI\n KASAN: null-ptr-deref in range [0x0000000000000220-0x0000000000000227]\n RIP: 0010:devgroup_mt+0xff/0x350\n Call Trace:\n  <TASK>\n  nft_match_eval (net/netfilter/nft_compat.c:407)\n  nft_do_chain (net/netfilter/nf_tables_core.c:285)\n  nft_do_chain_arp (net/netfilter/nft_chain_filter.c:61)\n  nf_hook_slow (net/netfilter/core.c:623)\n  arp_xmit (net/ipv4/arp.c:666)\n  </TASK>\n Kernel panic - not syncing: Fatal exception in interrupt\n\nAdd a helper xt_family_has_inet_hooks() and call it from both\nxt_check_match() and xt_check_target(): when a UNSPEC match/target\ndeclares .hooks, reject families whose hook numbering differs from\nthe NF_INET_* scheme.\n\nAlso add .hooks to xt_devgroup so the framework-level check covers it;\npreviously it relied on manual hook validation in checkentry using\nNF_INET_* constants, which suffers from the same collision.\n\nFixes: 9291747f118d (\"netfilter: xtables: add device group match\")\nReported-by: Xiang Mei <xmei5@asu.edu>\nSigned-off-by: Weiming Shi <bestswngs@gmail.com>\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/netfilter/x_tables.c    | 36 ++++++++++++++++++++++++++++++++++++\n net/netfilter/xt_devgroup.c |  5 +++++\n 2 files changed, 41 insertions(+)",
    "diff": "diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c\nindex e594b3b7ad82..a600592d0bff 100644\n--- a/net/netfilter/x_tables.c\n+++ b/net/netfilter/x_tables.c\n@@ -477,6 +477,28 @@ int xt_check_proc_name(const char *name, unsigned int size)\n }\n EXPORT_SYMBOL(xt_check_proc_name);\n \n+/*\n+ * Families whose hook numbering follows the NF_INET_* scheme.\n+ * ARP hooks (IN=0, OUT=1, FORWARD=2) use different semantics and\n+ * collide numerically with NF_INET_* values, so UNSPEC matches/targets\n+ * that declare .hooks must not run on ARP (or any other family whose\n+ * hooks do not follow the INET layout).\n+ */\n+static bool xt_family_has_inet_hooks(u_int8_t family)\n+{\n+\tswitch (family) {\n+\tcase NFPROTO_IPV4:\n+\tcase NFPROTO_IPV6:\n+\tcase NFPROTO_BRIDGE:\n+\t\treturn true;\n+\tcase NFPROTO_INET:\n+\t\t/* nftables only */\n+\t\treturn false;\n+\tdefault:\n+\t\treturn false;\n+\t}\n+}\n+\n int xt_check_match(struct xt_mtchk_param *par,\n \t\t   unsigned int size, u16 proto, bool inv_proto)\n {\n@@ -501,6 +523,13 @@ int xt_check_match(struct xt_mtchk_param *par,\n \t\t\t\t    par->match->table, par->table);\n \t\treturn -EINVAL;\n \t}\n+\tif (par->match->family == NFPROTO_UNSPEC &&\n+\t    par->match->hooks &&\n+\t    !xt_family_has_inet_hooks(par->family)) {\n+\t\tpr_info_ratelimited(\"%s_tables: %s match: not valid for this family\\n\",\n+\t\t\t\t    xt_prefix[par->family], par->match->name);\n+\t\treturn -EINVAL;\n+\t}\n \tif (par->match->hooks && (par->hook_mask & ~par->match->hooks) != 0) {\n \t\tchar used[64], allow[64];\n \n@@ -1016,6 +1045,13 @@ int xt_check_target(struct xt_tgchk_param *par,\n \t\t\t\t    par->target->table, par->table);\n \t\treturn -EINVAL;\n \t}\n+\tif (par->target->family == NFPROTO_UNSPEC &&\n+\t    par->target->hooks &&\n+\t    !xt_family_has_inet_hooks(par->family)) {\n+\t\tpr_info_ratelimited(\"%s_tables: %s target: not valid for this family\\n\",\n+\t\t\t\t    xt_prefix[par->family], par->target->name);\n+\t\treturn -EINVAL;\n+\t}\n \tif (par->target->hooks && (par->hook_mask & ~par->target->hooks) != 0) {\n \t\tchar used[64], allow[64];\n \ndiff --git a/net/netfilter/xt_devgroup.c b/net/netfilter/xt_devgroup.c\nindex 9520dd00070b..8246bcfd2094 100644\n--- a/net/netfilter/xt_devgroup.c\n+++ b/net/netfilter/xt_devgroup.c\n@@ -62,6 +62,11 @@ static struct xt_match devgroup_mt_reg __read_mostly = {\n \t.checkentry\t= devgroup_mt_checkentry,\n \t.matchsize\t= sizeof(struct xt_devgroup_info),\n \t.family\t\t= NFPROTO_UNSPEC,\n+\t.hooks\t\t= (1 << NF_INET_PRE_ROUTING) |\n+\t\t\t  (1 << NF_INET_LOCAL_IN) |\n+\t\t\t  (1 << NF_INET_FORWARD) |\n+\t\t\t  (1 << NF_INET_LOCAL_OUT) |\n+\t\t\t  (1 << NF_INET_POST_ROUTING),\n \t.me\t\t= THIS_MODULE\n };\n \n",
    "prefixes": [
        "net",
        "05/14"
    ]
}