* [PATCH net 0/6] netfilter updates for net
@ 2023-08-23 15:26 Florian Westphal
0 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2023-08-23 15:26 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel
Hello,
This PR contains nf_tables updates for your *net* tree.
First patch fixes table validation, I broke this in 6.4 when tracking
validation state per table, reported by Pablo, fixup from myself.
Second patch makes sure objects waiting for memory release have been
released, this was broken in 6.1, patch from Pablo Neira Ayuso.
Patch three is a fix-for-fix from previous PR: In case a transaction
gets aborted, gc sequence counter needs to be incremented so pending
gc requests are invalidated, from Pablo.
Same for patch 4: gc list needs to use gc list lock, not destroy lock,
also from Pablo.
Patch 5 fixes a UaF in a set backend, but this should only occur when
failslab is enabled for GFP_KERNEL allocations, broken since feature
was added in 5.6, from myself.
Patch 6 fixes a double-free bug that was also added via previous PR:
We must not schedule gc work if the previous batch is still queued.
The following changes since commit bfedba3b2c7793ce127680bc8f70711e05ec7a17:
ibmveth: Use dcbf rather than dcbfl (2023-08-23 11:51:16 +0100)
are available in the Git repository at:
ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/netfilter/nf tags/nf-23-08-23
for you to fetch changes up to 8e51830e29e12670b4c10df070a4ea4c9593e961:
netfilter: nf_tables: defer gc run if previous batch is still pending (2023-08-23 16:12:59 +0200)
----------------------------------------------------------------
netfilter pull request 2023-08-23
----------------------------------------------------------------
Florian Westphal (3):
netfilter: nf_tables: validate all pending tables
netfilter: nf_tables: fix out of memory error handling
netfilter: nf_tables: defer gc run if previous batch is still pending
Pablo Neira Ayuso (3):
netfilter: nf_tables: flush pending destroy work before netlink notifier
netfilter: nf_tables: GC transaction race with abort path
netfilter: nf_tables: use correct lock to protect gc_list
include/net/netfilter/nf_tables.h | 6 ++++++
net/netfilter/nf_tables_api.c | 23 +++++++++++++++--------
net/netfilter/nft_set_hash.c | 3 +++
net/netfilter/nft_set_pipapo.c | 13 ++++++++++---
net/netfilter/nft_set_rbtree.c | 3 +++
5 files changed, 37 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 0/6] netfilter updates for net
@ 2023-09-06 16:25 Florian Westphal
0 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2023-09-06 16:25 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel
Hello,
This PR contains nf_tables updates for your *net* tree.
This time almost all fixes are for old bugs:
First patch fixes a 4-byte stack OOB write, from myself.
This was broken ever since nftables was switches from 128 to 32bit
register addressing in v4.1.
2nd patch fixes an out-of-bounds read.
This has been broken ever since xt_osf got added in 2.6.31, the bug
was then just moved around during refactoring, from Wander Lairson Costa.
3rd patch adds a missing enum description, from Phil Sutter.
4th patch fixes a UaF inftables that occurs when userspace adds
elements with a timeout so small that expiration happens while the
transaction is still in progress. Fix from Pablo Neira Ayuso.
Patch 5 fixes a memory out of bounds access, this was
broken since v4.20. Patch from Kyle Zeng and Jozsef Kadlecsik.
Patch 6 fixes another bogus memory access when building audit
record. Bug added in the previous pull request, fix from Pablo.
The following changes since commit 1a961e74d5abbea049588a3d74b759955b4ed9d5:
net: phylink: fix sphinx complaint about invalid literal (2023-09-06 07:46:49 +0100)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-23-09-06
for you to fetch changes up to 9b5ba5c9c5109bf89dc64a3f4734bd125d1ce52e:
netfilter: nf_tables: Unbreak audit log reset (2023-09-06 18:09:12 +0200)
----------------------------------------------------------------
netfilter pull request 2023-09-06
----------------------------------------------------------------
Florian Westphal (1):
netfilter: nftables: exthdr: fix 4-byte stack OOB write
Kyle Zeng (1):
netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
Pablo Neira Ayuso (2):
netfilter: nft_set_rbtree: skip sync GC for new elements in this transaction
netfilter: nf_tables: Unbreak audit log reset
Phil Sutter (1):
netfilter: nf_tables: uapi: Describe NFTA_RULE_CHAIN_ID
Wander Lairson Costa (1):
netfilter: nfnetlink_osf: avoid OOB read
include/uapi/linux/netfilter/nf_tables.h | 1 +
net/netfilter/ipset/ip_set_hash_netportnet.c | 1 +
net/netfilter/nf_tables_api.c | 11 ++++++-----
net/netfilter/nfnetlink_osf.c | 8 ++++++++
net/netfilter/nft_exthdr.c | 22 ++++++++++++++--------
net/netfilter/nft_set_rbtree.c | 8 ++++++--
6 files changed, 36 insertions(+), 15 deletions(-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 0/6] netfilter: updates for net
@ 2025-12-16 19:08 Florian Westphal
2025-12-19 8:50 ` Paolo Abeni
0 siblings, 1 reply; 11+ messages in thread
From: Florian Westphal @ 2025-12-16 19:08 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
Hi,
The following patchset contains Netfilter fixes for *net*:
1) Jozsef Kadlecsik is retiring. Fortunately Jozsef will still keep an
eye on ipset patches.
2) remove a bogus direction check from nat core, this caused spurious
flakes in the 'reverse clash' selftest, from myself.
3) nf_tables doesn't need to do chain validation on register store,
from Pablo Neira Ayuso.
4) nf_tables shouldn't revisit chains during ruleset (graph) validation
if possible. Both 3 and 4 were slated for -next initially but there
are now two independent reports of people hitting soft lockup errors
during ruleset validation, so it makes no sense anymore to route
this via -next given this is -stable material. From myself.
5) call cond_resched() in a more frequently visited place during nf_tables
chain validation, this wasn't possible earlier due to rcu read lock,
but nowadays its not held anymore during set walks.
6) Don't fail conntrack packetdrill test with HZ=100 kernels.
Please, pull these changes from:
The following changes since commit 885bebac9909994050bbbeed0829c727e42bd1b7:
nfc: pn533: Fix error code in pn533_acr122_poweron_rdr() (2025-12-11 01:40:00 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-25-12-16
for you to fetch changes up to fec7b0795548b43e2c3c46e3143c34ef6070341c:
selftests: netfilter: packetdrill: avoid failure on HZ=100 kernel (2025-12-15 15:04:04 +0100)
----------------------------------------------------------------
netfilter pull request nf-25-12-16
----------------------------------------------------------------
Florian Westphal (4):
netfilter: nf_nat: remove bogus direction check
netfilter: nf_tables: avoid chain re-validation if possible
netfilter: nf_tables: avoid softlockup warnings in nft_chain_validate
selftests: netfilter: packetdrill: avoid failure on HZ=100 kernel
Jozsef Kadlecsik (1):
MAINTAINERS: Remove Jozsef Kadlecsik from MAINTAINERS file
Pablo Neira Ayuso (1):
netfilter: nf_tables: remove redundant chain validation on register store
CREDITS | 1 +
MAINTAINERS | 1 -
include/net/netfilter/nf_tables.h | 34 ++++++---
net/netfilter/nf_nat_core.c | 14 +---
net/netfilter/nf_tables_api.c | 84 +++++++++++++++++-----
.../net/netfilter/conntrack_reverse_clash.c | 13 ++--
.../net/netfilter/conntrack_reverse_clash.sh | 2 +
.../packetdrill/conntrack_syn_challenge_ack.pkt | 2 +-
8 files changed, 107 insertions(+), 44 deletions(-)
# WARNING: skip 0001-MAINTAINERS-Remove-Jozsef-Kadlecsik-from-MAINTAINERS.patch, no "Fixes" tag!
# INFO: 0002-netfilter-nf_nat-remove-bogus-direction-check.patch fixes commit from v6.12-rc1~38^2^2~13
# INFO: 0003-netfilter-nf_tables-remove-redundant-chain-validatio.patch fixes commit from v4.18-rc1~114^2~78^2~5
# WARNING: skip 0004-netfilter-nf_tables-avoid-chain-re-validation-if-pos.patch, no "Fixes" tag!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net 0/6] netfilter: updates for net
2025-12-16 19:08 [PATCH net 0/6] netfilter: updates for net Florian Westphal
@ 2025-12-19 8:50 ` Paolo Abeni
0 siblings, 0 replies; 11+ messages in thread
From: Paolo Abeni @ 2025-12-19 8:50 UTC (permalink / raw)
To: Florian Westphal, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netfilter-devel,
pablo
On 12/16/25 8:08 PM, Florian Westphal wrote:
> The following patchset contains Netfilter fixes for *net*:
>
> 1) Jozsef Kadlecsik is retiring. Fortunately Jozsef will still keep an
> eye on ipset patches.
>
> 2) remove a bogus direction check from nat core, this caused spurious
> flakes in the 'reverse clash' selftest, from myself.
>
> 3) nf_tables doesn't need to do chain validation on register store,
> from Pablo Neira Ayuso.
>
> 4) nf_tables shouldn't revisit chains during ruleset (graph) validation
> if possible. Both 3 and 4 were slated for -next initially but there
> are now two independent reports of people hitting soft lockup errors
> during ruleset validation, so it makes no sense anymore to route
> this via -next given this is -stable material. From myself.
>
> 5) call cond_resched() in a more frequently visited place during nf_tables
> chain validation, this wasn't possible earlier due to rcu read lock,
> but nowadays its not held anymore during set walks.
>
> 6) Don't fail conntrack packetdrill test with HZ=100 kernels.
>
> Please, pull these changes from:
> The following changes since commit 885bebac9909994050bbbeed0829c727e42bd1b7:
>
> nfc: pn533: Fix error code in pn533_acr122_poweron_rdr() (2025-12-11 01:40:00 -0800)
>
> are available in the Git repository at:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-25-12-16
>
> for you to fetch changes up to fec7b0795548b43e2c3c46e3143c34ef6070341c:
>
> selftests: netfilter: packetdrill: avoid failure on HZ=100 kernel (2025-12-15 15:04:04 +0100)
Pulled, thanks!
Paolo
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 0/6] netfilter: updates for net
@ 2026-01-02 11:41 Florian Westphal
2026-01-02 11:41 ` [PATCH net 1/6] netfilter: nft_set_pipapo: fix range overlap detection Florian Westphal
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
Hi,
The following patchset contains Netfilter fixes for *net*:
1) Fix overlap detection for nf_tables with concatenated ranges.
There are cases where element could not be added due to a conflict
with existing range, while kernel reports success to userspace.
2) update selftest to cover this bug.
3) synproxy update path should use READ/WRITE once as we replace
config struct while packet path might read it in parallel.
This relies on said config struct to fit sizeof(long).
From Fernando Fernandez Mancera.
4) Don't return -EEXIST from xtables in module load path, a pending
patch to module infra will spot a warning if this happens.
From Daniel Gomez.
5) Fix a memory leak in nf_tables when chain hits 2**32 users
and rule is to be hw-offloaded, from Zilin Guan.
6) Avoid infinite list growth when insert rate is high in nf_conncount,
also from Fernando.
Please, pull these changes from:
The following changes since commit dbf8fe85a16a33d6b6bd01f2bc606fc017771465:
Merge tag 'net-6.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (2025-12-30 08:45:58 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-26-01-02
for you to fetch changes up to 7811ba452402d58628e68faedf38745b3d485e3c:
netfilter: nf_conncount: update last_gc only when GC has been performed (2026-01-02 10:44:28 +0100)
----------------------------------------------------------------
netfilter pull request nf-26-01-02
----------------------------------------------------------------
Daniel Gomez (1):
netfilter: replace -EEXIST with -EBUSY
Fernando Fernandez Mancera (2):
netfilter: nft_synproxy: avoid possible data-race on update operation
netfilter: nf_conncount: update last_gc only when GC has been performed
Florian Westphal (2):
netfilter: nft_set_pipapo: fix range overlap detection
selftests: netfilter: nft_concat_range.sh: add check for overlap detection bug
Zilin Guan (1):
netfilter: nf_tables: fix memory leak in nf_tables_newrule()
net/bridge/netfilter/ebtables.c | 2 +-
net/netfilter/nf_conncount.c | 2 +-
net/netfilter/nf_log.c | 4 +-
net/netfilter/nf_tables_api.c | 3 +-
net/netfilter/nft_set_pipapo.c | 4 +-
net/netfilter/nft_synproxy.c | 6 +--
net/netfilter/x_tables.c | 2 +-
.../selftests/net/netfilter/nft_concat_range.sh | 45 +++++++++++++++++++++-
8 files changed, 56 insertions(+), 12 deletions(-)
# WARNING: 0000-cover-letter.patch lacks signed-off-by tag!
# WARNING: skip 0000-cover-letter.patch, no "Fixes" tag!
# INFO: 0001-netfilter-nft_set_pipapo-fix-range-overlap-detection.patch fixes commit from v5.6~21^2~5^2~5
# WARNING: skip 0002-selftests-netfilter-nft_concat_range.sh-add-check-fo.patch, no "Fixes" tag!
# INFO: 0003-netfilter-nft_synproxy-avoid-possible-data-race-on-u.patch fixes commit from v5.4-rc1~131^2~26^2~23
# WARNING: skip 0004-netfilter-replace-EEXIST-with-EBUSY.patch, no "Fixes" tag!
# INFO: 0005-netfilter-nf_tables-fix-memory-leak-in-nf_tables_new.patch fixes commit from v6.5-rc2~22^2~39^2~5
# INFO: 0006-netfilter-nf_conncount-update-last_gc-only-when-GC-h.patch fixes commit from v5.19-rc1~159^2~45^2~2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net 1/6] netfilter: nft_set_pipapo: fix range overlap detection
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
2026-01-02 11:41 ` [PATCH net 2/6] selftests: netfilter: nft_concat_range.sh: add check for overlap detection bug Florian Westphal
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
set->klen has to be used, not sizeof(). The latter only compares a
single register but a full check of the entire key is needed.
Example:
table ip t {
map s {
typeof iifname . ip saddr : verdict
flags interval
}
}
nft add element t s '{ "lo" . 10.0.0.0/24 : drop }' # no error, expected
nft add element t s '{ "lo" . 10.0.0.0/24 : drop }' # no error, expected
nft add element t s '{ "lo" . 10.0.0.0/8 : drop }' # bug: no error
The 3rd 'add element' should be rejected via -ENOTEMPTY, not -EEXIST,
so userspace / nft can report an error to the user.
The latter is only correct for the 2nd case (re-add of existing element).
As-is, userspace is told that the command was successful, but no elements were
added.
After this patch, 3rd command gives:
Error: Could not process rule: File exists
add element t s { "lo" . 127.0.0.0/8 . "lo" : drop }
^^^^^^^^^^^^^^^^^^^^^^^^^
Fixes: 0eb4b5ee33f2 ("netfilter: nft_set_pipapo: Separate partial and complete overlap cases on insertion")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nft_set_pipapo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
index 112fe46788b6..6d77a5f0088a 100644
--- a/net/netfilter/nft_set_pipapo.c
+++ b/net/netfilter/nft_set_pipapo.c
@@ -1317,8 +1317,8 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
else
dup_end = dup_key;
- if (!memcmp(start, dup_key->data, sizeof(*dup_key->data)) &&
- !memcmp(end, dup_end->data, sizeof(*dup_end->data))) {
+ if (!memcmp(start, dup_key->data, set->klen) &&
+ !memcmp(end, dup_end->data, set->klen)) {
*elem_priv = &dup->priv;
return -EEXIST;
}
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 2/6] selftests: netfilter: nft_concat_range.sh: add check for overlap detection bug
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
2026-01-02 11:41 ` [PATCH net 1/6] netfilter: nft_set_pipapo: fix range overlap detection Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
2026-01-02 11:41 ` [PATCH net 3/6] netfilter: nft_synproxy: avoid possible data-race on update operation Florian Westphal
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
without 'netfilter: nft_set_pipapo: fix range overlap detection':
reject overlapping range on add 0s [FAIL]
Returned success for add { 1.2.3.4 . 1.2.4.1-1.2.4.2 } given set:
table inet filter {
[..]
elements = { 1.2.3.4 . 1.2.4.1 counter packets 0 bytes 0,
1.2.3.0-1.2.3.4 . 1.2.4.2 counter packets 0 bytes 0 }
}
The element collides with existing ones and was not added, but kernel
returned success to userspace.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
.../net/netfilter/nft_concat_range.sh | 45 ++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/netfilter/nft_concat_range.sh b/tools/testing/selftests/net/netfilter/nft_concat_range.sh
index ad97c6227f35..394166f224a4 100755
--- a/tools/testing/selftests/net/netfilter/nft_concat_range.sh
+++ b/tools/testing/selftests/net/netfilter/nft_concat_range.sh
@@ -29,7 +29,7 @@ TYPES="net_port port_net net6_port port_proto net6_port_mac net6_port_mac_proto
net6_port_net6_port net_port_mac_proto_net"
# Reported bugs, also described by TYPE_ variables below
-BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate"
+BUGS="flush_remove_add reload net_port_proto_match avx2_mismatch doublecreate insert_overlap"
# List of possible paths to pktgen script from kernel tree for performance tests
PKTGEN_SCRIPT_PATHS="
@@ -420,6 +420,18 @@ race_repeat 0
perf_duration 0
"
+TYPE_insert_overlap="
+display reject overlapping range on add
+type_spec ipv4_addr . ipv4_addr
+chain_spec ip saddr . ip daddr
+dst addr4
+proto icmp
+
+race_repeat 0
+
+perf_duration 0
+"
+
# Set template for all tests, types and rules are filled in depending on test
set_template='
flush ruleset
@@ -1954,6 +1966,37 @@ EOF
return 0
}
+add_fail()
+{
+ if nft add element inet filter test "$1" 2>/dev/null ; then
+ err "Returned success for add ${1} given set:"
+ err "$(nft -a list set inet filter test )"
+ return 1
+ fi
+
+ return 0
+}
+
+test_bug_insert_overlap()
+{
+ local elements="1.2.3.4 . 1.2.4.1"
+
+ setup veth send_"${proto}" set || return ${ksft_skip}
+
+ add "{ $elements }" || return 1
+
+ elements="1.2.3.0-1.2.3.4 . 1.2.4.1"
+ add_fail "{ $elements }" || return 1
+
+ elements="1.2.3.0-1.2.3.4 . 1.2.4.2"
+ add "{ $elements }" || return 1
+
+ elements="1.2.3.4 . 1.2.4.1-1.2.4.2"
+ add_fail "{ $elements }" || return 1
+
+ return 0
+}
+
test_reported_issues() {
eval test_bug_"${subtest}"
}
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 3/6] netfilter: nft_synproxy: avoid possible data-race on update operation
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
2026-01-02 11:41 ` [PATCH net 1/6] netfilter: nft_set_pipapo: fix range overlap detection Florian Westphal
2026-01-02 11:41 ` [PATCH net 2/6] selftests: netfilter: nft_concat_range.sh: add check for overlap detection bug Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
2026-01-02 11:41 ` [PATCH net 4/6] netfilter: replace -EEXIST with -EBUSY Florian Westphal
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
From: Fernando Fernandez Mancera <fmancera@suse.de>
During nft_synproxy eval we are reading nf_synproxy_info struct which
can be modified on update operation concurrently. As nf_synproxy_info
struct fits in 32 bits, use READ_ONCE/WRITE_ONCE annotations.
Fixes: ee394f96ad75 ("netfilter: nft_synproxy: add synproxy stateful object support")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nft_synproxy.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nft_synproxy.c b/net/netfilter/nft_synproxy.c
index 5d3e51825985..4d3e5a31b412 100644
--- a/net/netfilter/nft_synproxy.c
+++ b/net/netfilter/nft_synproxy.c
@@ -48,7 +48,7 @@ static void nft_synproxy_eval_v4(const struct nft_synproxy *priv,
struct tcphdr *_tcph,
struct synproxy_options *opts)
{
- struct nf_synproxy_info info = priv->info;
+ struct nf_synproxy_info info = READ_ONCE(priv->info);
struct net *net = nft_net(pkt);
struct synproxy_net *snet = synproxy_pernet(net);
struct sk_buff *skb = pkt->skb;
@@ -79,7 +79,7 @@ static void nft_synproxy_eval_v6(const struct nft_synproxy *priv,
struct tcphdr *_tcph,
struct synproxy_options *opts)
{
- struct nf_synproxy_info info = priv->info;
+ struct nf_synproxy_info info = READ_ONCE(priv->info);
struct net *net = nft_net(pkt);
struct synproxy_net *snet = synproxy_pernet(net);
struct sk_buff *skb = pkt->skb;
@@ -340,7 +340,7 @@ static void nft_synproxy_obj_update(struct nft_object *obj,
struct nft_synproxy *newpriv = nft_obj_data(newobj);
struct nft_synproxy *priv = nft_obj_data(obj);
- priv->info = newpriv->info;
+ WRITE_ONCE(priv->info, newpriv->info);
}
static struct nft_object_type nft_synproxy_obj_type;
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 4/6] netfilter: replace -EEXIST with -EBUSY
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
` (2 preceding siblings ...)
2026-01-02 11:41 ` [PATCH net 3/6] netfilter: nft_synproxy: avoid possible data-race on update operation Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
2026-01-02 11:41 ` [PATCH net 5/6] netfilter: nf_tables: fix memory leak in nf_tables_newrule() Florian Westphal
2026-01-02 11:41 ` [PATCH net 6/6] netfilter: nf_conncount: update last_gc only when GC has been performed Florian Westphal
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
From: Daniel Gomez <da.gomez@samsung.com>
The -EEXIST error code is reserved by the module loading infrastructure
to indicate that a module is already loaded. When a module's init
function returns -EEXIST, userspace tools like kmod interpret this as
"module already loaded" and treat the operation as successful, returning
0 to the user even though the module initialization actually failed.
Replace -EEXIST with -EBUSY to ensure correct error reporting in the module
initialization path.
Affected modules:
* ebtable_broute ebtable_filter ebtable_nat arptable_filter
* ip6table_filter ip6table_mangle ip6table_nat ip6table_raw
* ip6table_security iptable_filter iptable_mangle iptable_nat
* iptable_raw iptable_security
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/bridge/netfilter/ebtables.c | 2 +-
net/netfilter/nf_log.c | 4 ++--
net/netfilter/x_tables.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 5697e3949a36..a04fc1757528 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1299,7 +1299,7 @@ int ebt_register_template(const struct ebt_table *t, int (*table_init)(struct ne
list_for_each_entry(tmpl, &template_tables, list) {
if (WARN_ON_ONCE(strcmp(t->name, tmpl->name) == 0)) {
mutex_unlock(&ebt_mutex);
- return -EEXIST;
+ return -EBUSY;
}
}
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 74cef8bf554c..62cf6a30875e 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -89,7 +89,7 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
if (pf == NFPROTO_UNSPEC) {
for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++) {
if (rcu_access_pointer(loggers[i][logger->type])) {
- ret = -EEXIST;
+ ret = -EBUSY;
goto unlock;
}
}
@@ -97,7 +97,7 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
rcu_assign_pointer(loggers[i][logger->type], logger);
} else {
if (rcu_access_pointer(loggers[pf][logger->type])) {
- ret = -EEXIST;
+ ret = -EBUSY;
goto unlock;
}
rcu_assign_pointer(loggers[pf][logger->type], logger);
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 90b7630421c4..48105ea3df15 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1764,7 +1764,7 @@ EXPORT_SYMBOL_GPL(xt_hook_ops_alloc);
int xt_register_template(const struct xt_table *table,
int (*table_init)(struct net *net))
{
- int ret = -EEXIST, af = table->af;
+ int ret = -EBUSY, af = table->af;
struct xt_template *t;
mutex_lock(&xt[af].mutex);
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 5/6] netfilter: nf_tables: fix memory leak in nf_tables_newrule()
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
` (3 preceding siblings ...)
2026-01-02 11:41 ` [PATCH net 4/6] netfilter: replace -EEXIST with -EBUSY Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
2026-01-02 11:41 ` [PATCH net 6/6] netfilter: nf_conncount: update last_gc only when GC has been performed Florian Westphal
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
From: Zilin Guan <zilin@seu.edu.cn>
In nf_tables_newrule(), if nft_use_inc() fails, the function jumps to
the err_release_rule label without freeing the allocated flow, leading
to a memory leak.
Fix this by adding a new label err_destroy_flow and jumping to it when
nft_use_inc() fails. This ensures that the flow is properly released
in this error case.
Fixes: 1689f25924ada ("netfilter: nf_tables: report use refcount overflow")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_tables_api.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 618af6e90773..729a92781a1a 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4439,7 +4439,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
if (!nft_use_inc(&chain->use)) {
err = -EMFILE;
- goto err_release_rule;
+ goto err_destroy_flow;
}
if (info->nlh->nlmsg_flags & NLM_F_REPLACE) {
@@ -4489,6 +4489,7 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
err_destroy_flow_rule:
nft_use_dec_restore(&chain->use);
+err_destroy_flow:
if (flow)
nft_flow_rule_destroy(flow);
err_release_rule:
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net 6/6] netfilter: nf_conncount: update last_gc only when GC has been performed
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
` (4 preceding siblings ...)
2026-01-02 11:41 ` [PATCH net 5/6] netfilter: nf_tables: fix memory leak in nf_tables_newrule() Florian Westphal
@ 2026-01-02 11:41 ` Florian Westphal
5 siblings, 0 replies; 11+ messages in thread
From: Florian Westphal @ 2026-01-02 11:41 UTC (permalink / raw)
To: netdev
Cc: Paolo Abeni, David S. Miller, Eric Dumazet, Jakub Kicinski,
netfilter-devel, pablo
From: Fernando Fernandez Mancera <fmancera@suse.de>
Currently last_gc is being updated everytime a new connection is
tracked, that means that it is updated even if a GC wasn't performed.
With a sufficiently high packet rate, it is possible to always bypass
the GC, causing the list to grow infinitely.
Update the last_gc value only when a GC has been actually performed.
Fixes: d265929930e2 ("netfilter: nf_conncount: reduce unnecessary GC")
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_conncount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conncount.c b/net/netfilter/nf_conncount.c
index 3654f1e8976c..8487808c8761 100644
--- a/net/netfilter/nf_conncount.c
+++ b/net/netfilter/nf_conncount.c
@@ -229,6 +229,7 @@ static int __nf_conncount_add(struct net *net,
nf_ct_put(found_ct);
}
+ list->last_gc = (u32)jiffies;
add_new_node:
if (WARN_ON_ONCE(list->count > INT_MAX)) {
@@ -248,7 +249,6 @@ static int __nf_conncount_add(struct net *net,
conn->jiffies32 = (u32)jiffies;
list_add_tail(&conn->node, &list->head);
list->count++;
- list->last_gc = (u32)jiffies;
out_put:
if (refcounted)
--
2.51.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-01-02 11:42 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 11:41 [PATCH net 0/6] netfilter: updates for net Florian Westphal
2026-01-02 11:41 ` [PATCH net 1/6] netfilter: nft_set_pipapo: fix range overlap detection Florian Westphal
2026-01-02 11:41 ` [PATCH net 2/6] selftests: netfilter: nft_concat_range.sh: add check for overlap detection bug Florian Westphal
2026-01-02 11:41 ` [PATCH net 3/6] netfilter: nft_synproxy: avoid possible data-race on update operation Florian Westphal
2026-01-02 11:41 ` [PATCH net 4/6] netfilter: replace -EEXIST with -EBUSY Florian Westphal
2026-01-02 11:41 ` [PATCH net 5/6] netfilter: nf_tables: fix memory leak in nf_tables_newrule() Florian Westphal
2026-01-02 11:41 ` [PATCH net 6/6] netfilter: nf_conncount: update last_gc only when GC has been performed Florian Westphal
-- strict thread matches above, loose matches on Subject: below --
2025-12-16 19:08 [PATCH net 0/6] netfilter: updates for net Florian Westphal
2025-12-19 8:50 ` Paolo Abeni
2023-09-06 16:25 [PATCH net 0/6] netfilter " Florian Westphal
2023-08-23 15:26 Florian Westphal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).