Commit e8b19b9
netfilter: nf_tables: fix use-after-free in nf_tables_addchain()
jira VULN-177697
cve CVE-2026-23231
commit-author Inseo An <y0un9sa@gmail.com>
commit 71e99ee
nf_tables_addchain() publishes the chain to table->chains via
list_add_tail_rcu() (in nft_chain_add()) before registering hooks.
If nf_tables_register_hook() then fails, the error path calls
nft_chain_del() (list_del_rcu()) followed by nf_tables_chain_destroy()
with no RCU grace period in between.
This creates two use-after-free conditions:
1) Control-plane: nf_tables_dump_chains() traverses table->chains
under rcu_read_lock(). A concurrent dump can still be walking
the chain when the error path frees it.
2) Packet path: for NFPROTO_INET, nf_register_net_hook() briefly
installs the IPv4 hook before IPv6 registration fails. Packets
entering nft_do_chain() via the transient IPv4 hook can still be
dereferencing chain->blob_gen_X when the error path frees the
chain.
Add synchronize_rcu() between nft_chain_del() and the chain destroy
so that all RCU readers -- both dump threads and in-flight packet
evaluation -- have finished before the chain is freed.
Fixes: 91c7b38 ("netfilter: nf_tables: use new transaction infrastructure to handle chain")
Signed-off-by: Inseo An <y0un9sa@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
(cherry picked from commit 71e99ee)
Signed-off-by: CIQ Kernel Automation <ciq_kernel_automation@ciq.com>1 parent 6aebf64 commit e8b19b9
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
| 2482 | + | |
2482 | 2483 | | |
2483 | 2484 | | |
2484 | 2485 | | |
| |||
0 commit comments