Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226129/?format=api
{ "id": 2226129, "url": "http://patchwork.ozlabs.org/api/patches/2226129/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260422094444.198178-3-pablo@netfilter.org/", "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": "<20260422094444.198178-3-pablo@netfilter.org>", "list_archive_url": null, "date": "2026-04-22T09:44:44", "name": "[nf,v2,3/3] netfilter: nft_fwd_netdev: use recursion counter in neigh egress path", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8320722c6cf2efcd14103d91f3a4dac6d534981c", "submitter": { "id": 1315, "url": "http://patchwork.ozlabs.org/api/people/1315/?format=api", "name": "Pablo Neira Ayuso", "email": "pablo@netfilter.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260422094444.198178-3-pablo@netfilter.org/mbox/", "series": [ { "id": 500956, "url": "http://patchwork.ozlabs.org/api/series/500956/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=500956", "date": "2026-04-22T09:44:43", "name": "[nf,v2,1/3] netfilter: replace skb_try_make_writable() by skb_ensure_writable()", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/500956/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226129/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226129/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <netfilter-devel+bounces-12126-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\tdkim=pass (2048-bit key;\n unprotected) header.d=netfilter.org header.i=@netfilter.org\n header.a=rsa-sha256 header.s=2025 header.b=F2KymRtx;\n\tdkim-atps=neutral", "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-12126-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=\"F2KymRtx\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.70.190.124", "smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=netfilter.org" ], "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 4g0vfG2bcWz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 19:52:38 +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 33EFB301F9B1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 09:45:00 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5E5663C8738;\n\tWed, 22 Apr 2026 09:44:55 +0000 (UTC)", "from mail.netfilter.org (mail.netfilter.org [217.70.190.124])\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 8644332BF52\n\tfor <netfilter-devel@vger.kernel.org>; Wed, 22 Apr 2026 09:44:53 +0000 (UTC)", "from localhost.localdomain (mail-agni [217.70.190.124])\n\tby mail.netfilter.org (Postfix) with ESMTPSA id CA0796017E\n\tfor <netfilter-devel@vger.kernel.org>; Wed, 22 Apr 2026 11:44:51 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776851094; cv=none;\n b=jBO6vVTrc/b89neF9bt/srnKa06ctndsTLVajK68u+VDuQBiybl0jAWZITAcywFVb9Zi1weUIzOu155qBHthYZKp3Rj/7YtUtNGQLYXF85zpO5Pue42oilIB0TTa5b/gUt1t1gdDZQeeyQgW/MW95Pd4XZtlMgZ18Nf8lZiJaS8=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776851094; c=relaxed/simple;\n\tbh=frOhg9qHKJ+e/ABNH67CCZQdXVCZvt6LgpZOjWR2xuA=;\n\th=From:To:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=WYLCARDcmY7MEfJChrt+rrBw1JttW8rX1Z4QxmHUPVUwRofELBJ2gT66dpw7yKJ3NA7NElHCcGv7EyAG0rsiKOg9iHiZ3bgirEdU0wpk2qhvfrgfeQ4e2VIdmhZE0bqgnpzQ0FKGP+qswUKTsVGDTIte8kTEHME/8P5EKfOL1u0=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=netfilter.org;\n spf=pass smtp.mailfrom=netfilter.org;\n dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org\n header.b=F2KymRtx; arc=none smtp.client-ip=217.70.190.124", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org;\n\ts=2025; t=1776851091;\n\tbh=RAC6s5AkodAwF3xgiRD0CKvL05C6iqJd2onJgkd4jA0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=F2KymRtxpb64oBJpUDN9bZJ2K8KkdrJXhcSxrWXYzRJCyGIeBAea3LGF4Kj8sSU7z\n\t uSsshJjIKAEawS2td6mxpQL3EUDQccV8Y7dKYcsxefL5Z5XozSgwzYr9OGo26a9xyu\n\t YZTMP5gMxPFXCtFPPgXPhXcYUOWAavIfU34iyV2v0kKwZvI6kmqSXE64SUz1vjyncO\n\t 5MFFzoa3ZBH23xK4uh2h82ejIyaBBdlpgv1ReQE6PAoF966YlkBM/dcYQYYIPew+rH\n\t 78N4dcxKXmP7GDZbR89pnj9DCFBZba3EcvYkZB7Tx+Ixfa6XeeBqI/F9i+jJV206rd\n\t 3lUPL9RacFohg==", "From": "Pablo Neira Ayuso <pablo@netfilter.org>", "To": "netfilter-devel@vger.kernel.org", "Subject": "[PATCH nf,v2 3/3] netfilter: nft_fwd_netdev: use recursion counter in\n neigh egress path", "Date": "Wed, 22 Apr 2026 11:44:44 +0200", "Message-ID": "<20260422094444.198178-3-pablo@netfilter.org>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260422094444.198178-1-pablo@netfilter.org>", "References": "<20260422094444.198178-1-pablo@netfilter.org>", "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\nnft_fwd_neigh can be used in egress chains (NF_NETDEV_EGRESS). When the\nforwarding rule targets the same device or two devices forward to each\nother, neigh_xmit() triggers dev_queue_xmit() which re-enters\nnf_hook_egress(), causing infinite recursion and stack overflow.\n\nMove the nf_get_nf_dup_skb_recursion() accessor and NF_RECURSION_LIMIT\nto the shared header nf_dup_netdev.h as a static inline, so that\nnft_fwd_netdev can use the recursion counter directly without exported\nfunction call overhead. Guard neigh_xmit() with the same recursion\nlimit already used in nf_do_netdev_egress().\n\nFixes: f87b9464d152 (\"netfilter: nft_fwd_netdev: Support egress hook\")\nReported-by: Xiang Mei <xmei5@asu.edu>\nSigned-off-by: Weiming Shi <bestswngs@gmail.com>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\nv2: no changes\n\n include/net/netfilter/nf_dup_netdev.h | 13 +++++++++++++\n net/netfilter/nf_dup_netdev.c | 16 ----------------\n net/netfilter/nft_fwd_netdev.c | 7 +++++++\n 3 files changed, 20 insertions(+), 16 deletions(-)", "diff": "diff --git a/include/net/netfilter/nf_dup_netdev.h b/include/net/netfilter/nf_dup_netdev.h\nindex b175d271aec9..609bcf422a9b 100644\n--- a/include/net/netfilter/nf_dup_netdev.h\n+++ b/include/net/netfilter/nf_dup_netdev.h\n@@ -3,10 +3,23 @@\n #define _NF_DUP_NETDEV_H_\n \n #include <net/netfilter/nf_tables.h>\n+#include <linux/netdevice.h>\n+#include <linux/sched.h>\n \n void nf_dup_netdev_egress(const struct nft_pktinfo *pkt, int oif);\n void nf_fwd_netdev_egress(const struct nft_pktinfo *pkt, int oif);\n \n+#define NF_RECURSION_LIMIT\t2\n+\n+static inline u8 *nf_get_nf_dup_skb_recursion(void)\n+{\n+#ifndef CONFIG_PREEMPT_RT\n+\treturn this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);\n+#else\n+\treturn ¤t->net_xmit.nf_dup_skb_recursion;\n+#endif\n+}\n+\n struct nft_offload_ctx;\n struct nft_flow_rule;\n \ndiff --git a/net/netfilter/nf_dup_netdev.c b/net/netfilter/nf_dup_netdev.c\nindex e348fb90b8dc..3b0a70e154cd 100644\n--- a/net/netfilter/nf_dup_netdev.c\n+++ b/net/netfilter/nf_dup_netdev.c\n@@ -13,22 +13,6 @@\n #include <net/netfilter/nf_tables_offload.h>\n #include <net/netfilter/nf_dup_netdev.h>\n \n-#define NF_RECURSION_LIMIT\t2\n-\n-#ifndef CONFIG_PREEMPT_RT\n-static u8 *nf_get_nf_dup_skb_recursion(void)\n-{\n-\treturn this_cpu_ptr(&softnet_data.xmit.nf_dup_skb_recursion);\n-}\n-#else\n-\n-static u8 *nf_get_nf_dup_skb_recursion(void)\n-{\n-\treturn ¤t->net_xmit.nf_dup_skb_recursion;\n-}\n-\n-#endif\n-\n static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\tenum nf_dev_hooks hook)\n {\ndiff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c\nindex 95b2af3eede4..08deac69b254 100644\n--- a/net/netfilter/nft_fwd_netdev.c\n+++ b/net/netfilter/nft_fwd_netdev.c\n@@ -152,6 +152,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,\n \t\tgoto out;\n \t}\n \n+\tif (*nf_get_nf_dup_skb_recursion() > NF_RECURSION_LIMIT) {\n+\t\tverdict = NF_DROP;\n+\t\tgoto out;\n+\t}\n+\n \tdev = dev_get_by_index_rcu(nft_net(pkt), oif);\n \tif (dev == NULL) {\n \t\tverdict = NF_DROP;\n@@ -160,7 +165,9 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,\n \n \tskb->dev = dev;\n \tskb_clear_tstamp(skb);\n+\t(*nf_get_nf_dup_skb_recursion())++;\n \tneigh_xmit(neigh_table, dev, addr, skb);\n+\t(*nf_get_nf_dup_skb_recursion())--;\n out:\n \tregs->verdict.code = verdict;\n }\n", "prefixes": [ "nf", "v2", "3/3" ] }