All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf 0/5] netfilter: xtables: fix module unload and teardown races
@ 2026-05-02  7:56 Florian Westphal
  2026-05-02  7:56 ` [PATCH nf 1/5] netfilter: xtables: allocate hook ops while under mutex Florian Westphal
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Florian Westphal @ 2026-05-02  7:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: tristan, Florian Westphal

1) Fixes a potential NULL dereference in xtables hook unregistration during
network namespace exit. Allocate hook operations within xtables core
*before* registering the table to avoid exposing a table with NULL
operations. Ensure tables stop processing packets before teardown
if hook registration fails.

2) Refactor xtables to use a single `xt_unregister_table_pre_exit` function.
Eliminate code duplication by centralizing table unregistration logic
within the xtables core. ebtables cannot be changed due to incompatibility.

3) Unregister netfilter table templates before module removal. This prevents
a race condition where userspace instantiates a new table after the pernet
unreg removed the current table.

4) Add `xtables_unregister_table_exit` to fully unregister netfilter tables
during module removal. Unlink the table from dying lists, then free hook
operations. Fixes an issue where userspace couldn't re-instantiate tables
after `rmmod`.

5) Refactor ebtables table removal to a two-stage scheme, mirroring recent
x_tables updates. Ensure table operations assignment happens while holding
the ebt mutex.

Florian Westphal (5):
  netfilter: xtables: allocate hook ops while under mutex
  netfilter: x_tables: add and use xt_unregister_table_pre_exit
  netfilter: x_tables: unregister the templates first
  netfilter: x_tables: add and use xtables_unregister_table_exit
  netfilter: ebtables: move to two-stage removal scheme

 include/linux/netfilter/x_tables.h        |   4 +-
 include/linux/netfilter_arp/arp_tables.h  |   1 -
 include/linux/netfilter_ipv4/ip_tables.h  |   1 -
 include/linux/netfilter_ipv6/ip6_tables.h |   1 -
 net/bridge/netfilter/ebtable_broute.c     |   2 +-
 net/bridge/netfilter/ebtable_nat.c        |   2 +-
 net/bridge/netfilter/ebtables.c           |  52 +++++---
 net/ipv4/netfilter/arp_tables.c           |  53 ++------
 net/ipv4/netfilter/arptable_filter.c      |   4 +-
 net/ipv4/netfilter/ip_tables.c            |  59 ++-------
 net/ipv4/netfilter/iptable_filter.c       |   4 +-
 net/ipv4/netfilter/iptable_mangle.c       |   4 +-
 net/ipv4/netfilter/iptable_nat.c          |   1 +
 net/ipv4/netfilter/iptable_raw.c          |   4 +-
 net/ipv4/netfilter/iptable_security.c     |   4 +-
 net/ipv6/netfilter/ip6_tables.c           |  56 ++-------
 net/ipv6/netfilter/ip6table_filter.c      |   4 +-
 net/ipv6/netfilter/ip6table_mangle.c      |   4 +-
 net/ipv6/netfilter/ip6table_nat.c         |   1 +
 net/ipv6/netfilter/ip6table_raw.c         |   4 +-
 net/ipv6/netfilter/ip6table_security.c    |   4 +-
 net/netfilter/x_tables.c                  | 144 +++++++++++++++++++---
 22 files changed, 205 insertions(+), 208 deletions(-)

-- 
2.53.0

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

end of thread, other threads:[~2026-05-04 23:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02  7:56 [PATCH nf 0/5] netfilter: xtables: fix module unload and teardown races Florian Westphal
2026-05-02  7:56 ` [PATCH nf 1/5] netfilter: xtables: allocate hook ops while under mutex Florian Westphal
2026-05-02  7:56 ` [PATCH nf 2/5] netfilter: x_tables: add and use xt_unregister_table_pre_exit Florian Westphal
2026-05-02  7:56 ` [PATCH nf 3/5] netfilter: x_tables: unregister the templates first Florian Westphal
2026-05-04 18:47   ` Tristan Madani
2026-05-04 23:04     ` Florian Westphal
2026-05-02  7:56 ` [PATCH nf 4/5] netfilter: x_tables: add and use xtables_unregister_table_exit Florian Westphal
2026-05-02  7:56 ` [PATCH nf 5/5] netfilter: ebtables: move to two-stage removal scheme 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.