get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219625,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2219625/?format=api",
    "project": {
        "id": 26,
        "url": "http://patchwork.ozlabs.org/api/1.0/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
    },
    "msgid": "<df9ac8b2cfbfcacf0cc4e6f2e01113f0b16ad37f.1775228821.git.n05ec@lzu.edu.cn>",
    "date": "2026-04-03T15:52:52",
    "name": "[v4] netfilter: xt_multiport: validate range encoding in checkentry",
    "commit_ref": null,
    "pull_url": null,
    "state": "under-review",
    "archived": false,
    "hash": "841ac7d8093445506efe70f89ec81158dd61ce16",
    "submitter": {
        "id": 92912,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/92912/?format=api",
        "name": "Ren Wei",
        "email": "n05ec@lzu.edu.cn"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/df9ac8b2cfbfcacf0cc4e6f2e01113f0b16ad37f.1775228821.git.n05ec@lzu.edu.cn/mbox/",
    "series": [
        {
            "id": 498651,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/498651/?format=api",
            "date": "2026-04-03T15:52:52",
            "name": "[v4] netfilter: xt_multiport: validate range encoding in checkentry",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/498651/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219625/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <netfilter-devel+bounces-11611-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-11611-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=13.75.44.102",
            "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=lzu.edu.cn",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=lzu.edu.cn"
        ],
        "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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnNd32FnFz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 02:56:39 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id EF41A3094D05\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  3 Apr 2026 15:53:47 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id A12793C9EE0;\n\tFri,  3 Apr 2026 15:53:46 +0000 (UTC)",
            "from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net\n [13.75.44.102])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 6BD6F230BDB;\n\tFri,  3 Apr 2026 15:53:40 +0000 (UTC)",
            "from enjou-Legion-Y7000P-2019.coin-barley.ts.net (unknown\n [172.23.56.36])\n\tby app1 (Coremail) with SMTP id ygmowABXz_9U4s9p5d2jAA--.37129S2;\n\tFri, 03 Apr 2026 23:52:52 +0800 (CST)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775231626; cv=none;\n b=VfwJ6j4TOdnG8ebaeYxfxVjF0azebyE6mC5DOajVdjFyS+Kw2WRQSNPGV/fh1vBKBbawvAiKu+Za7s1bQpZ2vCo5IpOhryjPtPKUoxlUVyOm/xufYBk+bRqefGbwBmOP9pIZ9uhEW9P3KV04lKWMFmlPm2xFz8tibS20OCWBpwM=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775231626; c=relaxed/simple;\n\tbh=D1e2olgVJeIYMvsd6OjKX99SYPIpmzcquojkKTFR1tI=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=m0tTAtTtSGkQPqZhgTAM5od6eTrL1CfqEypvCW2Jfi3uLV42p5w93UZ0nwbuzgEcNm5xDBHiWYj1BXvDXOd71a3HOCZweZCGgQzSSkL+eoU4P7Md6Ng5LtvTnTCKZFaz3XISGGwyuIkFfXTMcFQ/+9fC74kZLyGmZm57vhCwRjg=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=lzu.edu.cn;\n spf=pass smtp.mailfrom=lzu.edu.cn; arc=none smtp.client-ip=13.75.44.102",
        "From": "Ren Wei <n05ec@lzu.edu.cn>",
        "To": "netfilter-devel@vger.kernel.org,\n\tnetdev@vger.kernel.org",
        "Cc": "pablo@netfilter.org,\n\tfw@strlen.de,\n\tphil@nwl.cc,\n\tdavem@davemloft.net,\n\tedumazet@google.com,\n\tkuba@kernel.org,\n\tpabeni@redhat.com,\n\thorms@kernel.org,\n\tyasuyuki.kozakai@toshiba.co.jp,\n\tkaber@trash.net,\n\tyifanwucs@gmail.com,\n\ttomapufckgml@gmail.com,\n\tyuantan098@gmail.com,\n\tbird@lzu.edu.cn,\n\tz1652074432@gmail.com,\n\tn05ec@lzu.edu.cn,\n\tenjou1224z@gmail.com",
        "Subject": "[PATCH v4] netfilter: xt_multiport: validate range encoding in\n checkentry",
        "Date": "Fri,  3 Apr 2026 23:52:52 +0800",
        "Message-ID": "\n <df9ac8b2cfbfcacf0cc4e6f2e01113f0b16ad37f.1775228821.git.n05ec@lzu.edu.cn>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<cover.1774624314.git.n05ec@lzu.edu.cn>",
        "References": "<cover.1774624314.git.n05ec@lzu.edu.cn>",
        "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",
        "X-CM-TRANSID": "ygmowABXz_9U4s9p5d2jAA--.37129S2",
        "X-Coremail-Antispam": "1UD129KBjvJXoWxZw45Cw4UuF45ur18uF45Wrg_yoW5Kr1xpa\n\ty5GF15GrWkZFWaqFsayr1kJF15Cr4kXr48ua43J3srJFsxWr95tw4rtF9IvFs8Ary5CFW8\n\ttF4qvrn0kw15u37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUBj1xkIjI8I6I8E6xAIw20EY4v20xvaj40_JFC_Wr1l1IIY67AE\n\tw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2\n\tIY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2\n\tjsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52\n\tx082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWU\n\tGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4\n\t8JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2xKxwCY1x0262kK\n\te7AKxVW8ZVWrXwCY02Avz4vE-syl42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxFaVAv8V\n\tW8GwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480\n\tY4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7\n\tIYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k2\n\t6cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxV\n\tAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRpOJnUUUUU=",
        "X-CM-SenderInfo": "zqqvvuo6o23hxhgxhubq/1tbiAQMGCWnOkPwYCQAAsX"
    },
    "content": "ports_match_v1() treats any non-zero pflags entry as the start of a\nport range and unconditionally consumes the next ports[] element as\nthe range end.\n\nThe checkentry path currently validates protocol, flags and count, but\nit does not validate the range encoding itself. As a result, malformed\nrules can mark the last slot as a range start or place two range starts\nback to back, leaving ports_match_v1() to step past the last valid\nports[] element while interpreting the rule.\n\nReject malformed multiport v1 rules in checkentry by validating that\neach range start has a following element and that the following element\nis not itself marked as another range start.\n\nFixes: a89ecb6a2ef7 (\"[NETFILTER]: x_tables: unify IPv4/IPv6 multiport match\")\nReported-by: Yifan Wu <yifanwucs@gmail.com>\nReported-by: Juefei Pu <tomapufckgml@gmail.com>\nCo-developed-by: Yuan Tan <yuantan098@gmail.com>\nSigned-off-by: Yuan Tan <yuantan098@gmail.com>\nSuggested-by: Xin Liu <bird@lzu.edu.cn>\nTested-by: Yuhang Zheng <z1652074432@gmail.com>\nSigned-off-by: Ren Wei <n05ec@lzu.edu.cn>\n---\nChanges in v2:\n- drop the selftest patch\n- send the fix publicly to netfilter-devel\n\nChanges in v3:\n- drop datatype cleanup from the fix\n- keep the original check() interface unchanged\n- validate malformed range encoding in checkentry\n\nChanges in v4:\n- follow Pablo's suggested validation form\n- drop inline from multiport_valid_ranges\n- reject reversed port ranges\n\n net/netfilter/xt_multiport.c | 34 ++++++++++++++++++++++++++++++----\n 1 file changed, 30 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/net/netfilter/xt_multiport.c b/net/netfilter/xt_multiport.c\nindex 44a00f5acde8..a1691ff405d3 100644\n--- a/net/netfilter/xt_multiport.c\n+++ b/net/netfilter/xt_multiport.c\n@@ -105,6 +105,28 @@ multiport_mt(const struct sk_buff *skb, struct xt_action_param *par)\n \treturn ports_match_v1(multiinfo, ntohs(pptr[0]), ntohs(pptr[1]));\n }\n \n+static bool\n+multiport_valid_ranges(const struct xt_multiport_v1 *multiinfo)\n+{\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < multiinfo->count; i++) {\n+\t\tif (!multiinfo->pflags[i])\n+\t\t\tcontinue;\n+\n+\t\tif (++i >= multiinfo->count)\n+\t\t\treturn false;\n+\n+\t\tif (multiinfo->pflags[i])\n+\t\t\treturn false;\n+\n+\t\tif (multiinfo->ports[i - 1] > multiinfo->ports[i])\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n static inline bool\n check(u_int16_t proto,\n       u_int8_t ip_invflags,\n@@ -127,8 +149,10 @@ static int multiport_mt_check(const struct xt_mtchk_param *par)\n \tconst struct ipt_ip *ip = par->entryinfo;\n \tconst struct xt_multiport_v1 *multiinfo = par->matchinfo;\n \n-\treturn check(ip->proto, ip->invflags, multiinfo->flags,\n-\t\t     multiinfo->count) ? 0 : -EINVAL;\n+\tif (!check(ip->proto, ip->invflags, multiinfo->flags, multiinfo->count))\n+\t\treturn -EINVAL;\n+\n+\treturn multiport_valid_ranges(multiinfo) ? 0 : -EINVAL;\n }\n \n static int multiport_mt6_check(const struct xt_mtchk_param *par)\n@@ -136,8 +160,10 @@ static int multiport_mt6_check(const struct xt_mtchk_param *par)\n \tconst struct ip6t_ip6 *ip = par->entryinfo;\n \tconst struct xt_multiport_v1 *multiinfo = par->matchinfo;\n \n-\treturn check(ip->proto, ip->invflags, multiinfo->flags,\n-\t\t     multiinfo->count) ? 0 : -EINVAL;\n+\tif (!check(ip->proto, ip->invflags, multiinfo->flags, multiinfo->count))\n+\t\treturn -EINVAL;\n+\n+\treturn multiport_valid_ranges(multiinfo) ? 0 : -EINVAL;\n }\n \n static struct xt_match multiport_mt_reg[] __read_mostly = {\n",
    "prefixes": [
        "v4"
    ]
}