Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2219284/?format=api
{ "id": 2219284, "url": "http://patchwork.ozlabs.org/api/patches/2219284/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/d5c0d106e724c732436b985dd694272bcb813bb1.1775153311.git.n05ec@lzu.edu.cn/", "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": "<d5c0d106e724c732436b985dd694272bcb813bb1.1775153311.git.n05ec@lzu.edu.cn>", "list_archive_url": null, "date": "2026-04-02T18:21:17", "name": "[v3] netfilter: xt_multiport: validate range encoding in checkentry", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "46ed7a0f26b94daeeecae975994ad781d2617d36", "submitter": { "id": 92912, "url": "http://patchwork.ozlabs.org/api/people/92912/?format=api", "name": "Ren Wei", "email": "n05ec@lzu.edu.cn" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/d5c0d106e724c732436b985dd694272bcb813bb1.1775153311.git.n05ec@lzu.edu.cn/mbox/", "series": [ { "id": 498536, "url": "http://patchwork.ozlabs.org/api/series/498536/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=498536", "date": "2026-04-02T18:21:17", "name": "[v3] netfilter: xt_multiport: validate range encoding in checkentry", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/498536/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219284/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219284/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-11591-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:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11591-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=52.175.55.52", "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 sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::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 4fmqvP1gCGz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 05:22:09 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 506C73019476\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 2 Apr 2026 18:22:02 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C9F74377ED4;\n\tThu, 2 Apr 2026 18:22:00 +0000 (UTC)", "from azure-sdnproxy.icoremail.net (azure-sdnproxy.icoremail.net\n [52.175.55.52])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5C484248896;\n\tThu, 2 Apr 2026 18:21:55 +0000 (UTC)", "from enjou-Legion-Y7000P-2019.coin-barley.ts.net (unknown\n [172.23.56.36])\n\tby app1 (Coremail) with SMTP id ygmowADXTwCes85pe3ehAA--.36831S2;\n\tFri, 03 Apr 2026 02:21:18 +0800 (CST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775154120; cv=none;\n b=as9h8KgHEBJSWq9KmJYkpoknT4U9lcI9s8pomuZqOH9GoMxutVe8Cqqdlfi5DO+Y1lRC3ut0tfQKNiXsRVOMivGjIYD7SzHDqlqUvRz2r3TFTn4ewWfx18mdiVXxTJdPNghLUHPonSSwT/Wzu07RbF2Z1rMqLEQ5+6ZtWCAsLjI=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775154120; c=relaxed/simple;\n\tbh=lgoNUTaJxhgyGzRY56yJE0E1UczL7zUgigOg63Ad6Oo=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=GZnMdwHKg4HFsxG+V75LuhFCbiWi2/kJ6qOLo7KielfqdUR0+fc3StiS1oW6H7eC+1X0oMvJtOsmy7p7qnBIqR50xiXG8GvleW0r1sta7LjUnW6P/Vi2Vz2I/cMulu2K4CKJi48/cBFl2WcCiOzXcUA6zg63QbXw/QoYjSZz1bk=", "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=52.175.55.52", "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", "Subject": "[PATCH v3] netfilter: xt_multiport: validate range encoding in\n checkentry", "Date": "Fri, 3 Apr 2026 02:21:17 +0800", "Message-ID": "\n <d5c0d106e724c732436b985dd694272bcb813bb1.1775153311.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": "ygmowADXTwCes85pe3ehAA--.36831S2", "X-Coremail-Antispam": "1UD129KBjvJXoWxZw45Cw4UuF45ur18uF45Wrg_yoW5uryfpa\n\ty5GF15GrWkXFWaqFs2yr1kJF15Cr4kJw48ua43G347trsxWrykta1rtF9FvFs8Jry5CFW8\n\tJF4q9rn0kw15u37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUBF1xkIjI8I6I8E6xAIw20EY4v20xvaj40_JFC_Wr1l1IIY67AE\n\tw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2\n\tIY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2\n\tjsIE14v26F4j6r4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzx\n\tvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU\n\tJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V\n\tAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2xKxwCY1x02\n\t62kKe7AKxVW8ZVWrXwCY02Avz4vE-syl42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxFaV\n\tAv8VW8GwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E\n\t7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcV\n\tC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF\n\t04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7\n\tCjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRpOJnUUUUU=", "X-CM-SenderInfo": "zqqvvuo6o23hxhgxhubq/1tbiAQQFCWnOkPwA0AADsR" }, "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\n net/netfilter/xt_multiport.c | 30 ++++++++++++++++++++++++++----\n 1 file changed, 26 insertions(+), 4 deletions(-)", "diff": "diff --git a/net/netfilter/xt_multiport.c b/net/netfilter/xt_multiport.c\nindex 44a00f5acde8..07a0f2a3fc75 100644\n--- a/net/netfilter/xt_multiport.c\n+++ b/net/netfilter/xt_multiport.c\n@@ -105,6 +105,24 @@ 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 inline 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 + 1 >= multiinfo->count || multiinfo->pflags[i + 1])\n+\t\t\treturn false;\n+\n+\t\ti++;\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 +145,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 +156,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": [ "v3" ] }