Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2228968/?format=api
{ "id": 2228968, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228968/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260427150500.13754-3-pablo@netfilter.org/", "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": "<20260427150500.13754-3-pablo@netfilter.org>", "date": "2026-04-27T15:05:00", "name": "[nf,v6,3/3] netfilter: nft_fwd_netdev: use recursion counter in neigh egress path", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "5c29cf05d9ff9405b78602d424e6990de6fd8bde", "submitter": { "id": 1315, "url": "http://patchwork.ozlabs.org/api/1.1/people/1315/?format=api", "name": "Pablo Neira Ayuso", "email": "pablo@netfilter.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260427150500.13754-3-pablo@netfilter.org/mbox/", "series": [ { "id": 501670, "url": "http://patchwork.ozlabs.org/api/1.1/series/501670/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=501670", "date": "2026-04-27T15:04:58", "name": "[nf,v6,1/3] netfilter: nft_fwd_netdev: add device and headroom validate with neigh forwarding", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/501670/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2228968/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2228968/checks/", "tags": {}, "headers": { "Return-Path": "\n <netfilter-devel+bounces-12222-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=VteptDJU;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-12222-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=\"VteptDJU\"", "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 [172.234.253.10])\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 4g46TZ48Hyz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 01:11:14 +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 01DA63229B70\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 15:05:13 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 4C889324B1F;\n\tMon, 27 Apr 2026 15:05:09 +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 5A48F31F9BE\n\tfor <netfilter-devel@vger.kernel.org>; Mon, 27 Apr 2026 15:05:07 +0000 (UTC)", "from localhost.localdomain (mail-agni [217.70.190.124])\n\tby mail.netfilter.org (Postfix) with ESMTPSA id 65C2F60255\n\tfor <netfilter-devel@vger.kernel.org>; Mon, 27 Apr 2026 17:05:05 +0200 (CEST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777302308; cv=none;\n b=OL0urcmL0MYy/XnAwDY3hGY1jM4l5y4RaAxrNQXmrzQTPDK6BGvLdW4thgy+jFgLlUewSRSaopYbcv44osDqSxVserav6CYUJYH0nI4PCOCGpauMmCWLHf/MprONF59hfLBc9HBYd0cC++v0jybvUXudtr8NVBuY8Tl+PfhGqNE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777302308; c=relaxed/simple;\n\tbh=WYf8vmUKZCf9LfliQ48s5rAtFUvMEeuxXsDMeinDapY=;\n\th=From:To:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=Age7sF9XGVcA5Q8gcYQMXymD3SV+U9DLZoe8NQlKt/QmGBcaFnDcx+yqqB1Z9DTP0oPFtIulnD06GDiBWykWs7xKD9N+AyPo7QHsD8NYtwRFIaiUiowncZeX4hBkzXYHJRYpkiKH+rw+MXWrULajSm8+14neakwbEH4ErT+gXc0=", "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=VteptDJU; 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=1777302305;\n\tbh=AaQMBA9tZjn2JyJ2rECwzkiQtV3KoAhPk/5DEMh8n8o=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=VteptDJUhB7LzjHvubc2sxrItesoGW23Ygf97Rf1gxVMM2V/C5rnxy1s/k6urVAnD\n\t pDPoKLcpYu0SKn2gz6DvTqd8FwwM40mkKpsU3DbTQjbZqtQC/MGBUd45K5ax5ye/rw\n\t TOx/ajSeG90xrcmD7n7wL/eCkRmfXx0rftbCPKT6DilEq688J00xy11PWaLOcO3iJC\n\t 2nYpj2isbnE8/oWvs4rwLxkNMlIZOkUIKLWZpGjZNQs9hYgYqTFGLaGy6TIHo1zKoo\n\t QFdvUGdHrV21N4jSOTUka8axj0DYZ4wVMbO/SGaUUclH8UsBgmxxlociIzfrbzOAAe\n\t 1haN3wiztl/Iw==", "From": "Pablo Neira Ayuso <pablo@netfilter.org>", "To": "netfilter-devel@vger.kernel.org", "Subject": "[PATCH nf,v6 3/3] netfilter: nft_fwd_netdev: use recursion counter in\n neigh egress path", "Date": "Mon, 27 Apr 2026 17:05:00 +0200", "Message-ID": "<20260427150500.13754-3-pablo@netfilter.org>", "X-Mailer": "git-send-email 2.47.3", "In-Reply-To": "<20260427150500.13754-1-pablo@netfilter.org>", "References": "<20260427150500.13754-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\n[ Updated to cache the nf_get_nf_dup_skb_recursion pointer. --pablo ]\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---\nv6: 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 | 8 ++++++++\n 3 files changed, 21 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 c484a757cfb5..65768cbcc211 100644\n--- a/net/netfilter/nft_fwd_netdev.c\n+++ b/net/netfilter/nft_fwd_netdev.c\n@@ -95,6 +95,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,\n \t\t\t struct nft_regs *regs,\n \t\t\t const struct nft_pktinfo *pkt)\n {\n+\tu8 *nf_dup_skb_recursion = nf_get_nf_dup_skb_recursion();\n \tstruct nft_fwd_neigh *priv = nft_expr_priv(expr);\n \tvoid *addr = ®s->data[priv->sreg_addr];\n \tint oif = regs->data[priv->sreg_dev];\n@@ -153,6 +154,11 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,\n \t\tgoto out;\n \t}\n \n+\tif (*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@@ -170,7 +176,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_dup_skb_recursion)++;\n \tneigh_xmit(neigh_table, dev, addr, skb);\n+\t(*nf_dup_skb_recursion)--;\n out:\n \tregs->verdict.code = verdict;\n }\n", "prefixes": [ "nf", "v6", "3/3" ] }