Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2220994/?format=api
{ "id": 2220994, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220994/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260408163512.30537-4-fw@strlen.de/", "project": { "id": 26, "url": "http://patchwork.ozlabs.org/api/1.1/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": "<20260408163512.30537-4-fw@strlen.de>", "date": "2026-04-08T16:35:08", "name": "[net,3/7] netfilter: xt_multiport: validate range encoding in checkentry", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "841ac7d8093445506efe70f89ec81158dd61ce16", "submitter": { "id": 1025, "url": "http://patchwork.ozlabs.org/api/1.1/people/1025/?format=api", "name": "Florian Westphal", "email": "fw@strlen.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260408163512.30537-4-fw@strlen.de/mbox/", "series": [ { "id": 499159, "url": "http://patchwork.ozlabs.org/api/1.1/series/499159/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=499159", "date": "2026-04-08T16:35:05", "name": "[net,1/7] ipvs: fix NULL deref in ip_vs_add_service error path", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499159/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2220994/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2220994/checks/", "tags": {}, "headers": { "Return-Path": "\n <netfilter-devel+bounces-11741-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-11741-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 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frTJZ6wvGz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 02:38:06 +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 CADED3063107\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 8 Apr 2026 16:35:32 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0ACF83BAD8F;\n\tWed, 8 Apr 2026 16:35:32 +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 1A8293A1A4D;\n\tWed, 8 Apr 2026 16:35:29 +0000 (UTC)", "by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 4BE9360560; Wed, 08 Apr 2026 18:35:28 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775666131; cv=none;\n b=Egz3sJ1B1Yx117fYvgP5aYoIUOBs8LMmCKykbZZrFXmgbn0nUYhX2w9YQN+ftBefOR+kUhLvHTEalNGDzDIm8o65ssOTfkxSZgFsIYe25O4P7zax0swBuxV3Wu74DxuvlniSsYT/I4yOik1Cl4UL+3g+d8q5Gf5k+b/LPOPJd9E=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775666131; c=relaxed/simple;\n\tbh=SjMNDw3SfdzJVLoRRDNS82BHpA3RIY3BkTvJxwqHNiw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=ks18xNQBdKC6NKyvX525fUK10gkHFvV0OMy2zqawZwSNinW5bMV5g7r3CYA6WqXIsIO+tfYd8Sllt/ncAtOUgdO0ktZE3Y4ZxoIxMesY4cjTgf+NC3gqG3wyPNQqES6PeaZ9BGIqRfxYOBXII9ye1um12/9GTvwZvLhGBYPti8A=", "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 3/7] netfilter: xt_multiport: validate range encoding in\n checkentry", "Date": "Wed, 8 Apr 2026 18:35:08 +0200", "Message-ID": "<20260408163512.30537-4-fw@strlen.de>", "X-Mailer": "git-send-email 2.52.0", "In-Reply-To": "<20260408163512.30537-1-fw@strlen.de>", "References": "<20260408163512.30537-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: Ren Wei <n05ec@lzu.edu.cn>\n\nports_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>\nSigned-off-by: Florian Westphal <fw@strlen.de>\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": [ "net", "3/7" ] }