All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] tests: shell: add test case for netdev + dormant table
@ 2026-04-26 14:44 Florian Westphal
  2026-04-27  5:56 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2026-04-26 14:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

both commit update and abort path need to release memory associated with
netdev hooks.  kfree gets skipped because it mixes registration and
allocation.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 .../transactions/dormant_updchain_abort       | 23 +++++++++++++
 .../dumps/dormant_updchain_abort.json-nft     | 33 +++++++++++++++++++
 .../dumps/dormant_updchain_abort.nft          |  7 ++++
 3 files changed, 63 insertions(+)
 create mode 100755 tests/shell/testcases/transactions/dormant_updchain_abort
 create mode 100644 tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft
 create mode 100644 tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft

diff --git a/tests/shell/testcases/transactions/dormant_updchain_abort b/tests/shell/testcases/transactions/dormant_updchain_abort
new file mode 100755
index 000000000000..56ad887d0d92
--- /dev/null
+++ b/tests/shell/testcases/transactions/dormant_updchain_abort
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -e
+
+$NFT -f - <<EOF
+table netdev t {
+	flags dormant
+
+	chain c {
+		type filter hook ingress priority 0
+	}
+}
+EOF
+
+# check abort path frees transaction
+$NFT --check --f - <<EOF
+table netdev t {
+	flags dormant
+	chain c {
+		type filter hook ingress device lo priority 0
+	}
+}
+EOF
diff --git a/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft b/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft
new file mode 100644
index 000000000000..f6838c15e9f1
--- /dev/null
+++ b/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.json-nft
@@ -0,0 +1,33 @@
+{
+  "nftables": [
+    {
+      "metainfo": {
+        "version": "VERSION",
+        "release_name": "RELEASE_NAME",
+        "json_schema_version": 1
+      }
+    },
+    {
+      "table": {
+        "family": "netdev",
+        "name": "t",
+        "handle": 0,
+        "flags": [
+          "dormant"
+        ]
+      }
+    },
+    {
+      "chain": {
+        "family": "netdev",
+        "table": "t",
+        "name": "c",
+        "handle": 0,
+        "type": "filter",
+        "hook": "ingress",
+        "prio": 0,
+        "policy": "accept"
+      }
+    }
+  ]
+}
diff --git a/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft b/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft
new file mode 100644
index 000000000000..95dcc59a3e46
--- /dev/null
+++ b/tests/shell/testcases/transactions/dumps/dormant_updchain_abort.nft
@@ -0,0 +1,7 @@
+table netdev t {
+	flags dormant
+
+	chain c {
+		type filter hook ingress priority filter; policy accept;
+	}
+}
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nft] tests: shell: add test case for netdev + dormant table
  2026-04-26 14:44 [PATCH nft] tests: shell: add test case for netdev + dormant table Florian Westphal
@ 2026-04-27  5:56 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2026-04-27  5:56 UTC (permalink / raw)
  To: netfilter-devel

Florian Westphal <fw@strlen.de> wrote:
> both commit update and abort path need to release memory associated with
> netdev hooks.  kfree gets skipped because it mixes registration and
> allocation.

I have a kernel fix for this bug but I am waiting for the pending PR to
get merged before sending it, the fix depends on the new unlink+free
helper and doesn't apply to main branch.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-27  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-26 14:44 [PATCH nft] tests: shell: add test case for netdev + dormant table Florian Westphal
2026-04-27  5:56 ` Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.